Ë
    ¤eh¹.  ã                  ó–  — d Z ddlmZ ddlmZmZ ddlmZmZm	Z	 ddl
ZddlmZ ddlmZmZmZ ddlmZ dd	lmZmZ dd
lmZmZmZ ddlmZ ddlmZ ddlm Z  erddl!m"Z"m#Z# ddl$m%Z%m&Z& 	 	 	 	 	 	 	 	 	 	 dd„Z' G d„ de«      Z( G d„ de(«      Z) G d„ de(«      Z*dd„Z+d d„Z,	 	 	 	 	 	 d!d„Z-	 	 	 	 	 	 d!d„Z.d"d„Z/	 	 	 	 d#d„Z0	 	 	 	 d$d„Z1y)%z–
Module responsible for execution of NDFrame.describe() method.

Method NDFrame.describe() delegates actual execution to function describe_ndframe().
é    )Úannotations)ÚABCÚabstractmethod)ÚTYPE_CHECKINGÚCallableÚcastN)Ú	Timestamp)ÚDtypeObjÚNDFrameTÚnpt)Úvalidate_percentile)Úis_bool_dtypeÚis_numeric_dtype)Ú
ArrowDtypeÚDatetimeTZDtypeÚExtensionDtype)ÚFloat64Dtype)Úconcat)Úformat_percentiles)ÚHashableÚSequence)Ú	DataFrameÚSeriesc                óØ   — t        |«      }| j                  dk(  rt        t        d| «      ¬«      }nt	        t        d| «      ||¬«      }|j                  |¬«      }t        t        |«      S )a   Describe series or dataframe.

    Called from pandas.core.generic.NDFrame.describe()

    Parameters
    ----------
    obj: DataFrame or Series
        Either dataframe or series to be described.
    include : 'all', list-like of dtypes or None (default), optional
        A white list of data types to include in the result. Ignored for ``Series``.
    exclude : list-like of dtypes or None (default), optional,
        A black list of data types to omit from the result. Ignored for ``Series``.
    percentiles : list-like of numbers, optional
        The percentiles to include in the output. All should fall between 0 and 1.
        The default is ``[.25, .5, .75]``, which returns the 25th, 50th, and
        75th percentiles.

    Returns
    -------
    Dataframe or series description.
    é   r   ©Úobjr   )r   ÚincludeÚexclude)Úpercentiles)Ú_refine_percentilesÚndimÚSeriesDescriberr   ÚDataFrameDescriberÚdescriber   )r   r   r   r    Ú	describerÚresults         úZ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pandas/core/methods/describe.pyÚdescribe_ndframer)   7   sm   € ô8 & kÓ2€Kð ‡x�x�1‚}Ü#Ü�X˜sÓ#ô
‰	ô 'Ü�[ #Ó&ØØô
ˆ	ð ×Ñ¨KÐÓ8€FÜ”˜&Ó!Ð!ó    c                  ó*   — e Zd ZdZdd„Zedd„«       Zy)ÚNDFrameDescriberAbstractz”Abstract class for describing dataframe or series.

    Parameters
    ----------
    obj : Series or DataFrame
        Object to be described.
    c                ó   — || _         y ©Nr   )Úselfr   s     r(   Ú__init__z!NDFrameDescriberAbstract.__init__n   s	   € Øˆ�r*   c                 ó   — y)z¸Do describe either series or dataframe.

        Parameters
        ----------
        percentiles : list-like of numbers
            The percentiles to include in the output.
        N© )r/   r    s     r(   r%   z!NDFrameDescriberAbstract.describeq   s   � r*   N)r   úDataFrame | SeriesÚreturnÚNone)r    úSequence[float] | np.ndarrayr4   r3   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r0   r   r%   r2   r*   r(   r,   r,   e   s    „ ñóð òó ñr*   r,   c                  ó$   — e Zd ZU dZded<   dd„Zy)r#   z2Class responsible for creating series description.r   r   c                óR   — t        | j                  «      } || j                  |«      S r.   )Úselect_describe_funcr   )r/   r    Údescribe_funcs      r(   r%   zSeriesDescriber.describe�   s&   € Ü,Ø�H‰Hó
ˆñ ˜TŸX™X {Ó3Ð3r*   N)r    r6   r4   r   )r7   r8   r9   r:   Ú__annotations__r%   r2   r*   r(   r#   r#   |   s   … Ù<à	ƒKô4r*   r#   c                  óP   ‡ — e Zd ZU dZded<   	 	 	 	 	 	 	 	 dˆ fd„Zdd„Zd	d„Zˆ xZS )
r$   ab  Class responsible for creating dataobj description.

    Parameters
    ----------
    obj : DataFrame
        DataFrame to be described.
    include : 'all', list-like of dtypes or None
        A white list of data types to include in the result.
    exclude : list-like of dtypes or None
        A black list of data types to omit from the result.
    r   r   c               ó¦   •— || _         || _        |j                  dk(  r$|j                  j                  dk(  rt        d«      ‚t        ‰| �  |«       y )Né   r   z+Cannot describe a DataFrame without columns)r   r   r"   ÚcolumnsÚsizeÚ
ValueErrorÚsuperr0   )r/   r   r   r   Ú	__class__s       €r(   r0   zDataFrameDescriber.__init__—   sH   ø€ ð ˆŒØˆŒà�8‰8�qŠ=˜SŸ[™[×-Ñ-°Ò2ÜÐJÓKÐKä‰Ñ˜Õr*   c           	     óX  — | j                  «       }g }|j                  «       D ](  \  }}t        |«      }|j                   |||«      «       Œ* t	        |«      }t        |D �cg c]  }|j                  |d¬«      ‘Œ c}dd¬«      }	|j                  j                  «       |	_        |	S c c}w )NF)Úcopyr   )ÚaxisÚsort)	Ú_select_dataÚitemsr=   ÚappendÚreorder_columnsr   ÚreindexrC   rI   )
r/   r    ÚdataÚldescÚ_Úseriesr>   Ú	col_namesÚxÚds
             r(   r%   zDataFrameDescriber.describe¦   s¢   € Ø× Ñ Ó"ˆà ˆØŸ™›ò 	=‰IˆAˆvÜ0°Ó8ˆMØ�L‰L™ v¨{Ó;Õ<ð	=ô $ EÓ*ˆ	ÜØ7<Ö=°!ˆQ�Y‰Y�y uˆYÕ-Ò=ØØô
ˆð
 —L‘L×%Ñ%Ó'ˆŒ	Øˆùò >s   Á"B'c                ó¬  — | j                   €`| j                  €Tt        j                  dg}| j                  j                  |¬«      }t        |j                  «      dk(  r| j                  }|S | j                   dk(  r'| j                  �d}t        |«      ‚| j                  }|S | j                  j                  | j                   | j                  ¬«      }|S )zSelect columns to be described.Údatetime)r   r   Úallz*exclude must be None when include is 'all')r   r   )	r   r   ÚnpÚnumberr   Úselect_dtypesÚlenrC   rE   )r/   Údefault_includerQ   Úmsgs       r(   rL   zDataFrameDescriber._select_data·   sÂ   € à�L‰LÐ  t§|¡|Ð';ä46·I±I¸zÐ3JˆOØ—8‘8×)Ñ)°/Ð)ÓBˆDÜ�4—<‘<Ó  AÒ%Ø—x‘x�ð ˆð �\‰\˜UÒ"Ø�|‰|Ð'ØB�Ü  “oÐ%Ø—8‘8ˆDð ˆð	 —8‘8×)Ñ)ØŸ™ØŸ™ð *ó ˆDð ˆr*   )r   r   r   ústr | Sequence[str] | Noner   ra   r4   r5   )r    r6   r4   r   )r4   r   )	r7   r8   r9   r:   r?   r0   r%   rL   Ú__classcell__)rG   s   @r(   r$   r$   ˆ   sD   ø… ñ
ð 
ƒNðàðð ,ð	ð
 ,ðð 
õó÷"r*   r$   c                ó¸   — g }t        «       }t        d„ | D «       t        ¬«      }|D ]0  }|D ])  }||vsŒ|j                  |«       |j	                  |«       Œ+ Œ2 |S )z,Set a convenient order for rows for display.c              3  ó4   K  — | ]  }|j                   –— Œ y ­wr.   )Úindex)Ú.0rV   s     r(   ú	<genexpr>z"reorder_columns.<locals>.<genexpr>Ð   s   è ø€ Ò3¨˜AŸG�GÑ3ùs   ‚)Úkey)ÚsetÚsortedr^   ÚaddrN   )rR   ÚnamesÚ
seen_namesÚldesc_indexesÚidxnamesÚnames         r(   rO   rO   Ì   se   € à€EÜ #£€JÜÑ3¨UÔ3¼Ô=€MØ!ò #ˆØò 	#ˆDØ˜:Ò%Ø—‘˜tÔ$Ø—‘˜TÕ"ñ	#ð#ð
 €Lr*   c                ó˜  — ddl m} t        |«      }g d¢|z   dgz   }| j                  «       | j	                  «       | j                  «       | j                  «       g| j                  |«      j                  «       z   | j                  «       gz   }t        | j                  t        «      r_t        | j                  t        «      r:| j                  j                  dk(  rd}nYddl}t        |j!                  «       «      }n;t#        «       }n0| j                  j                  dv rt%        j                  d«      }nd} |||| j&                  |¬	«      S )
zÛDescribe series containing numerical data.

    Parameters
    ----------
    series : Series
        Series to be described.
    percentiles : list-like of numbers
        The percentiles to include in the output.
    r   ©r   )ÚcountÚmeanÚstdÚminÚmaxÚmNÚiufbÚfloat©re   rp   Údtype)Úpandasr   r   rs   rt   ru   rv   ÚquantileÚtolistrw   Ú
isinstancer|   r   r   ÚkindÚpyarrowÚfloat64r   r[   rp   )rT   r    r   Úformatted_percentilesÚ
stat_indexrW   r|   Úpas           r(   Údescribe_numeric_1dr‡   Ù   s   € õ ä.¨{Ó;Ðâ0Ð3HÑHÈEÈ7ÑR€Jà	�‰‹˜Ÿ™›¨¯
©
«°f·j±j³lÐCØ
�/‰/˜+Ó
&×
-Ñ
-Ó
/ñ	0à�:‰:‹<ˆ.ñ	ð ô �&—,‘,¤Ô/Ü�f—l‘l¤JÔ/Ø�|‰|× Ñ  CÒ'à‘ã$ä" 2§:¡:£<Ó0‘ä “N‰EØ	�‰×	Ñ	˜fÑ	$ä—‘˜Ó!‰àˆÙ�!˜:¨F¯K©K¸uÔEÐEr*   c                ó<  — g d¢}| j                  «       }t        ||dk7     «      }|dkD  r!|j                  d   |j                  d   }}d}n"t        j
                  t        j
                  }}d}| j                  «       |||g}ddlm}	  |	||| j                  |¬«      S )zãDescribe series containing categorical data.

    Parameters
    ----------
    data : Series
        Series to be described.
    percentiles_ignored : list-like of numbers
        Ignored, but in place to unify interface.
    )rs   ÚuniqueÚtopÚfreqr   NÚobjectrr   r{   )
Úvalue_countsr^   re   Úilocr[   Únanrs   r}   r   rp   )
rQ   Úpercentiles_ignoredrl   Ú	objcountsÚcount_uniquerŠ   r‹   r|   r'   r   s
             r(   Údescribe_categorical_1dr“     s–   € ò /€EØ×!Ñ!Ó#€IÜ�y ¨a¡Ñ0Ó1€LØ�aÒØ—O‘O AÑ&¨	¯©°qÑ(9ˆTˆØ‰ô —F‘FœBŸF™FˆTˆØˆà�j‰j‹l˜L¨#¨tÐ4€Fåá�& ¨D¯I©I¸UÔCÐCr*   c                óÆ  — ddg}| j                  «       }t        ||dk7     «      }| j                  «       |g}d}|dkD  rÜ|j                  d   |j                  d   }}| j
                  j                  }	| j                  «       j                  j                  d«      }
t        |«      }|j                  �|	�|j                  |	«      }n|j                  |	«      }|g d¢z  }|||t        |
j                  «       |	¬«      t        |
j                  «       |	¬«      gz  }n,|dd	gz  }|t         j"                  t         j"                  gz  }d
}ddlm}  |||| j(                  |¬«      S )zøDescribe series containing timestamp data treated as categorical.

    Parameters
    ----------
    data : Series
        Series to be described.
    percentiles_ignored : list-like of numbers
        Ignored, but in place to unify interface.
    rs   r‰   r   NÚi8)rŠ   r‹   ÚfirstÚlast)ÚtzrŠ   r‹   rŒ   rr   r{   )r�   r^   rs   re   rŽ   Údtr˜   ÚdropnaÚvaluesÚviewr	   ÚtzinfoÚ
tz_convertÚtz_localizerv   rw   r[   r�   r}   r   rp   )rQ   r�   rl   r‘   r’   r'   r|   rŠ   r‹   r˜   Úasintr   s               r(   Ú$describe_timestamp_as_categorical_1dr¡   "  sG  € ð �hÐ€EØ×!Ñ!Ó#€IÜ�y ¨a¡Ñ0Ó1€LØ'+§z¡z£|°\Ð&B€FØ€EØ�aÒØ—O‘O AÑ&¨	¯©°qÑ(9ˆTˆØ�W‰W�Z‰ZˆØ—‘“×$Ñ$×)Ñ)¨$Ó/ˆÜ˜‹nˆØ�:‰:Ð! b nà—.‘. Ó$‰Cà—/‘/ "Ó%ˆCØÒ1Ñ1ˆØØØÜ�e—i‘i“k bÔ)Ü�e—i‘i“k bÔ)ð	
ñ 	
‰ð 	�%˜�Ñ ˆØ”2—6‘6œ2Ÿ6™6Ð"Ñ"ˆØˆåá�& ¨D¯I©I¸UÔCÐCr*   c                ó&  — ddl m} t        |«      }g d¢|z   dgz   }| j                  «       | j	                  «       | j                  «       g| j                  |«      j                  «       z   | j                  «       gz   } |||| j                  ¬«      S )zÛDescribe series containing datetime64 dtype.

    Parameters
    ----------
    data : Series
        Series to be described.
    percentiles : list-like of numbers
        The percentiles to include in the output.
    r   rr   )rs   rt   rv   rw   )re   rp   )
r}   r   r   rs   rt   rv   r~   r   rw   rp   )rQ   r    r   r„   r…   rW   s         r(   Údescribe_timestamp_1dr£   R  s„   € õ ä.¨{Ó;Ðâ)Ð,AÑAÀUÀGÑK€Jà	�‰‹�t—y‘y“{ D§H¡H£JÐ/Ø
�-‰-˜Ó
$×
+Ñ
+Ó
-ñ	.à�8‰8‹:ˆ,ñ	ð ñ
 �!˜:¨D¯I©IÔ6Ð6r*   c                ó  — t        | j                  «      rt        S t        | «      rt        S | j                  j
                  dk(  st        | j                  t        «      rt        S | j                  j
                  dk(  rt        S t        S )z–Select proper function for describing series based on data type.

    Parameters
    ----------
    data : Series
        Series to be described.
    ÚMrx   )	r   r|   r“   r   r‡   r�   r€   r   r£   )rQ   s    r(   r=   r=   j  sc   € ô �T—Z‘ZÔ Ü&Ð&Ü	˜$Ô	Ü"Ð"Ø	�‰�‰˜CÒ	¤:¨d¯j©j¼/Ô#JÜ$Ð$Ø	�‰�‰˜CÒ	Ü"Ð"ä&Ð&r*   c                ó.  — | €t        j                  g d¢«      S t        | «      } t        | «       d| vr| j	                  d«       t        j
                  | «      } t        j                  | «      }| €J ‚t        |«      t        | «      k  rt        d«      ‚|S )zº
    Ensure that percentiles are unique and sorted.

    Parameters
    ----------
    percentiles : list-like of numbers, optional
        The percentiles to include in the output.
    )g      Ð?ç      à?g      è?r§   z%percentiles cannot contain duplicates)	r[   ÚarrayÚlistr   rN   Úasarrayr‰   r^   rE   )r    Úunique_pctss     r(   r!   r!   €  s–   € ð ÐÜ�x‰xÒ)Ó*Ð*ô �{Ó#€Kô ˜Ô$ð �+ÑØ×Ñ˜3Ôä—*‘*˜[Ó)€Kô —)‘)˜KÓ(€KØÐ"Ð"Ð"Ü
ˆ;Óœ#˜kÓ*Ò*ÜÐ@ÓAÐAàÐr*   )
r   r   r   ra   r   ra   r    ú#Sequence[float] | np.ndarray | Noner4   r   )rR   zSequence[Series]r4   zlist[Hashable])rT   r   r    úSequence[float]r4   r   )rQ   r   r�   r­   r4   r   )rQ   r   r    r­   r4   r   )rQ   r   r4   r   )r    r¬   r4   znpt.NDArray[np.float64])2r:   Ú
__future__r   Úabcr   r   Útypingr   r   r   Únumpyr[   Úpandas._libs.tslibsr	   Úpandas._typingr
   r   r   Úpandas.util._validatorsr   Úpandas.core.dtypes.commonr   r   Úpandas.core.dtypes.dtypesr   r   r   Úpandas.core.arrays.floatingr   Úpandas.core.reshape.concatr   Úpandas.io.formats.formatr   Úcollections.abcr   r   r}   r   r   r)   r,   r#   r$   rO   r‡   r“   r¡   r£   r=   r!   r2   r*   r(   ú<module>r»      s>  ðñõ
 #÷÷ñ ó å )÷ñ õ
 8÷÷ñ õ 5Ý -å 7á÷÷
ð+"à	ð+"ð (ð+"ð (ð	+"ð
 5ð+"ð ó+"ô\˜sô ô.	4Ð.ô 	4ôAÐ1ô AóH
ó&FðRDØ
ðDà(ðDð óDð@-DØ
ð-Dà(ð-Dð ó-Dó`7ð0'Ø
ð'àó'ð, Ø4ð àô r*   