Ë
    *�£j%  ã                  ó@   — d dl mZ d dlZd dlmZ d dlmZmZm	Z	 dd„Z
y)é    )ÚannotationsN)Úunique1d)ÚCategoricalÚCategoricalDtypeÚrecode_for_categoriesc                óð  — |r¨t        | j                  | j                  dk7     «      }|rt        j                  |«      }| j                  j                  |«      }t        | j                  | j                  |d¬«      }t        || j                  ¬«      }t        j                  ||¬«      S |r| S t        | j                  | j                  dk7     «      }|rt        j                  |«      }t        | j                  «      x}t        |«      kD  rCt        j                  t        j                  |«      |d¬«      }	t        j                  ||	f«      }n|}t        | | j                  j                  |«      «      S )aÙ  
    Code the categories to ensure we can groupby for categoricals.

    If observed=True, we return a new Categorical with the observed
    categories only.

    If sort=False, return a copy of self, coded with categories as
    returned by .unique(), followed by any categories not appearing in
    the data. If sort=True, return self.

    This method is needed solely to ensure the categorical index of the
    GroupBy result has categories in the order of appearance in the data
    (GH-8868).

    Parameters
    ----------
    c : Categorical
    sort : bool
        The value of the sort parameter groupby was called with.
    observed : bool
        Account only for the observed values

    Returns
    -------
    Categorical
        If sort=False, the new categories are set to the order of
        appearance in codes (unless ordered=True, in which case the
        original order is preserved), followed by any unrepresented
        categories in the original order.
    éÿÿÿÿF)Úcopy)Úordered)ÚdtypeT)Úassume_unique)r   ÚcodesÚnpÚsortÚ
categoriesÚtaker   r   r   r   Ú_simple_newÚlenÚ	setdiff1dÚarangeÚconcatenate)
Úcr   ÚobservedÚ
take_codesr   r   r   Úunique_notnan_codesÚnum_catÚmissing_codess
             úAC:\FundamentalWorkbench\vendor\pandas\core\groupby\categorical.pyÚrecode_for_groupbyr      s6  € ñ@ ô ˜aŸg™g a§g¡g°¡mÑ4Ó5ˆ
áÜŸ™ Ó,ˆJð —\‘\×&Ñ& zÓ2ˆ
Ü% a§g¡g¨q¯|©|¸ZÈeÔTˆô ! °Q·Y±YÔ?ˆÜ×&Ñ& u°EÔ:Ð:ñ Øˆô # 1§7¡7¨1¯7©7°b©=Ñ#9Ó:ÐÙÜ Ÿg™gÐ&9Ó:ÐÜ�q—|‘|Ó$Ð$ˆ¬Ð,?Ó(@Ò@äŸ™Ü�I‰I�gÓÐ 3À4ô
ˆô —^‘^Ð%8¸-Ð$HÓI‰
à(ˆ
ä�q˜!Ÿ,™,×+Ñ+¨JÓ7Ó8Ð8ó    )r   r   r   Úboolr   r!   Úreturnr   )Ú
__future__r   Únumpyr   Úpandas.core.algorithmsr   Úpandas.core.arrays.categoricalr   r   r   r   © r    r   Ú<module>r(      s   ðÝ "ã å +÷ñ ôF9r    