§
    Ò¬¸ju   ã                  ó    — d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ erd dlmZ d dlmZ d d	lmZ e G d
„ d¦  «        ¦   «         ZdS )é    )Úannotations)ÚTYPE_CHECKING)Ú
deprecated)Úunstable)Úwrap_s)Úexpr_dispatch)ÚSeries)ÚPySeries)ÚPolarsDataTypec                  óF  — e Zd ZdZdZd%d„Z ed¦  «        d&d	„¦   «         Z ed
¦  «        d'd„¦   «         Z ed¦  «        d&d„¦   «         Z	 ed¦  «        d'd„¦   «         Z
d&d„Zd&d„Zd(d„Zd)d„Zd*d+d„Z e¦   «         ddœd,d#„¦   «         Z e¦   «         d&d$„¦   «         ZdS )-ÚCatNameSpacez)Namespace for categorical related series.ÚcatÚseriesr	   ÚreturnÚNonec                ó   — |j         | _         d S ©N)Ú_s)Úselfr   s     úi/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/polars/series/categorical.pyÚ__init__zCatNameSpace.__init__   s   € Ø"œIˆŒˆˆó    zç`cat.get_categories()` is deprecated. To get the distinct values present in a Categorical column, use `Series.unique()`. For the fixed category list of an Enum, use its `dtype.categories`. This method will be removed in Polars 2.0.c                ó   — dS )ab  
        Get the categories stored in this data type.

        Examples
        --------
        >>> s = pl.Series(["foo", "bar", "foo", "foo", "ham"], dtype=pl.Categorical)
        >>> s.cat.get_categories()  # doctest: +SKIP
        shape: (3,)
        Series: '' [str]
        [
            "foo"
            "bar"
            "ham"
        ]
        N© ©r   s    r   Úget_categorieszCatNameSpace.get_categories   ó   € € € r   zu`cat.is_local()` is deprecated; Categoricals no longer have a local scope. This method will be removed in Polars 2.0.Úboolc                ó4   — | j                              ¦   «         S )zi
        Return whether or not the column is a local categorical.

        Always returns false.
        )r   Úcat_is_localr   s    r   Úis_localzCatNameSpace.is_local1   s   € ð Œw×#Ò#Ñ%Ô%Ð%r   zu`cat.to_local()` is deprecated; Categoricals no longer have a local scope. This method will be removed in Polars 2.0.c                óN   — t          | j                             ¦   «         ¦  «        S )zFSimply returns the column as-is, local representations are deprecated.)r   r   Úcat_to_localr   s    r   Úto_localzCatNameSpace.to_local=   s    € õ �d”g×*Ò*Ñ,Ô,Ñ-Ô-Ð-r   z†`cat.uses_lexical_ordering()` is deprecated; Categoricals are now always ordered lexically. This method will be removed in Polars 2.0.c                ó4   — | j                              ¦   «         S )a  
        Indicate whether the Series uses lexical ordering.

        Always returns true.

        Examples
        --------
        >>> s = pl.Series(["b", "a", "b"]).cast(pl.Categorical)
        >>> s.cat.uses_lexical_ordering()  # doctest: +SKIP
        True
        )r   Úcat_uses_lexical_orderingr   s    r   Úuses_lexical_orderingz"CatNameSpace.uses_lexical_orderingE   s   € ð  Œw×0Ò0Ñ2Ô2Ð2r   c                ó   — dS )u&  
        Return the byte-length of the string representation of each value.

        Returns
        -------
        Series
            Series of data type :class:`UInt32`.

        See Also
        --------
        len_chars

        Notes
        -----
        When working with non-ASCII text, the length in bytes is not the same as the
        length in characters. You may want to use :func:`len_chars` instead.
        Note that :func:`len_bytes` is much more performant (_O(1)_) than
        :func:`len_chars` (_O(n)_).

        Examples
        --------
        >>> s = pl.Series(["CafÃ©", "345", "æ�±äº¬", None], dtype=pl.Categorical)
        >>> s.cat.len_bytes()
        shape: (4,)
        Series: '' [u32]
        [
            5
            3
            6
            null
        ]
        Nr   r   s    r   Ú	len_byteszCatNameSpace.len_bytesW   r   r   c                ó   — dS )u  
        Return the number of characters of the string representation of each value.

        Returns
        -------
        Series
            Series of data type :class:`UInt32`.

        See Also
        --------
        len_bytes

        Notes
        -----
        When working with ASCII text, use :func:`len_bytes` instead to achieve
        equivalent output with much better performance:
        :func:`len_bytes` runs in _O(1)_, while :func:`len_chars` runs in (_O(n)_).

        A character is defined as a `Unicode scalar value`_. A single character is
        represented by a single byte when working with ASCII text, and a maximum of
        4 bytes otherwise.

        .. _Unicode scalar value: https://www.unicode.org/glossary/#unicode_scalar_value

        Examples
        --------
        >>> s = pl.Series(["CafÃ©", "345", "æ�±äº¬", None], dtype=pl.Categorical)
        >>> s.cat.len_chars()
        shape: (4,)
        Series: '' [u32]
        [
            4
            3
            2
            null
        ]
        Nr   r   s    r   Ú	len_charszCatNameSpace.len_charsy   r   r   ÚprefixÚstrc                ó   — dS )a{  
        Check if string representations of values start with a substring.

        Parameters
        ----------
        prefix
            Prefix substring.

        See Also
        --------
        contains : Check if the string repr contains a substring that matches a pattern.
        ends_with : Check if string repr ends with a substring.

        Examples
        --------
        >>> s = pl.Series("fruits", ["apple", "mango", None], dtype=pl.Categorical)
        >>> s.cat.starts_with("app")
        shape: (3,)
        Series: 'fruits' [bool]
        [
            true
            false
            null
        ]
        Nr   )r   r,   s     r   Ústarts_withzCatNameSpace.starts_with    r   r   Úsuffixc                ó   — dS )az  
        Check if string representations of values end with a substring.

        Parameters
        ----------
        suffix
            Suffix substring.

        See Also
        --------
        contains : Check if the string repr contains a substring that matches a pattern.
        starts_with : Check if string repr starts with a substring.

        Examples
        --------
        >>> s = pl.Series("fruits", ["apple", "mango", None], dtype=pl.Categorical)
        >>> s.cat.ends_with("go")
        shape: (3,)
        Series: 'fruits' [bool]
        [
            false
            true
            null
        ]
        Nr   )r   r0   s     r   Ú	ends_withzCatNameSpace.ends_with»   r   r   NÚoffsetÚintÚlengthú
int | Nonec                ó   — dS )aV  
        Extract a substring from the string representation of each string value.

        Parameters
        ----------
        offset
            Start index. Negative indexing is supported.
        length
            Length of the slice. If set to `None` (default), the slice is taken to the
            end of the string.

        Returns
        -------
        Series
            Series of data type :class:`String`.

        Notes
        -----
        Both the `offset` and `length` inputs are defined in terms of the number
        of characters in the (UTF8) string. A character is defined as a
        `Unicode scalar value`_. A single character is represented by a single byte
        when working with ASCII text, and a maximum of 4 bytes otherwise.

        .. _Unicode scalar value: https://www.unicode.org/glossary/#unicode_scalar_value

        Examples
        --------
        >>> s = pl.Series(["pear", None, "papaya", "dragonfruit"], dtype=pl.Categorical)
        >>> s.cat.slice(-3)
        shape: (4,)
        Series: '' [str]
        [
            "ear"
            null
            "aya"
            "uit"
        ]

        Using the optional `length` parameter

        >>> s.cat.slice(4, length=3)
        shape: (4,)
        Series: '' [str]
        [
            ""
            null
            "ya"
            "onf"
        ]
        Nr   )r   r3   r5   s      r   ÚslicezCatNameSpace.sliceÖ   r   r   T)ÚstrictÚdtyper   r9   c               ó   — dS )a
  
        Create a Series with a categorical or enum `dtype`.

        The input series must be the physical type of the categorical or enum dtype.

        Parameters
        ----------
        dtype
            The target categorical or enum dtype.
        strict
            Whether to panic when encountering an illegal category.

        .. warning::
            This functionality is currently considered **unstable**. It may be
            changed at any point without it being considered a breaking change.
        Nr   )r   r:   r9   s      r   ÚtozCatNameSpace.to
  r   r   c                ó   — dS )a  
        Get the physical values of a Series with a categorical or enum data type.

        .. warning::
            This functionality is currently considered **unstable**. It may be
            changed at any point without it being considered a breaking change.
        Nr   r   s    r   ÚphysicalzCatNameSpace.physical  r   r   )r   r	   r   r   )r   r	   )r   r   )r,   r-   r   r	   )r0   r-   r   r	   r   )r3   r4   r5   r6   r   r	   )r:   r   r9   r   r   r	   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	_accessorr   r   r   r!   r$   r'   r)   r+   r/   r2   r8   r   r<   r>   r   r   r   r   r      sÉ  € € € € € à3Ð3à€Ið&ð &ð &ð &ð €Zð	Wñô ð
ð ð ñô ð
ð" €Zð	5ñô ð&ð &ð &ñ	ô ð&ð €Zð	5ñô ð.ð .ð .ñ	ô ð.ð €Zð	5ñô ð3ð 3ð 3ñ	ô ð3ð ð  ð  ð  ðD%ð %ð %ð %ðNð ð ð ð6ð ð ð ð62ð 2ð 2ð 2ð 2ðh €X�Z„ZØ:>ð ð ð ð ð ñ „Zðð$ €X�Z„Zðð ð ñ „Zðð ð r   r   N)Ú
__future__r   Útypingr   Úpolars._utils.deprecationr   Úpolars._utils.unstabler   Úpolars._utils.wrapr   Úpolars.series.utilsr   Úpolarsr	   Úpolars._plrr
   Úpolars._typingr   r   r   r   r   ú<module>rM      s  ðØ "Ð "Ð "Ð "Ð "Ð "à  Ð  Ð  Ð  Ð  Ð  à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø +Ð +Ð +Ð +Ð +Ð +Ø %Ð %Ð %Ð %Ð %Ð %Ø -Ð -Ð -Ð -Ð -Ð -àð ØÐÐÐÐÐØ$Ð$Ð$Ð$Ð$Ð$ðð ð ð ð ð ð
 ðRð Rð Rð Rð Rñ Rô Rñ „ðRð Rð Rr   