
    Mh.                       S r SSKJr  SSKJrJr  SSKJrJrJ	r	  SSK
rSSKJr  SSKJrJrJr  SSKJr  SS	KJrJr  SS
KJrJrJr  SSKJr  SSKJr  SSKJ r   \(       a  SSK!J"r"J#r#  SSK$J%r%J&r&            SS jr' " S S\5      r( " S S\(5      r) " S S\(5      r*SS jr+S S jr,      S!S jr-      S!S jr.S"S jr/    S#S jr0    S$S jr1g)%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                    [        U5      nU R                  S:X  a  [        [        SU 5      S9nO[	        [        SU 5      UUS9nUR                  US9n[        [        U5      $ )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         N/var/www/html/env/lib/python3.13/site-packages/pandas/core/methods/describe.pydescribe_ndframer)   7   sm    8 &k2K xx1}#Xs#
	 '[#&
	 K8F&!!    c                  6    \ rS rSrSrSS jr\SS j5       rSrg)	NDFrameDescriberAbstracte   zAbstract class for describing dataframe or series.

Parameters
----------
obj : Series or DataFrame
    Object to be described.
c                    Xl         g Nr   )selfr   s     r(   __init__!NDFrameDescriberAbstract.__init__n   s    r*   c                    g)zDo describe either series or dataframe.

Parameters
----------
percentiles : list-like of numbers
    The percentiles to include in the output.
N )r0   r    s     r(   r%   !NDFrameDescriberAbstract.describeq   s    r*   r   N)r   DataFrame | SeriesreturnNone)r    Sequence[float] | np.ndarrayr7   r6   )	__name__
__module____qualname____firstlineno____doc__r1   r   r%   __static_attributes__r4   r*   r(   r,   r,   e   s       r*   r,   c                  .    \ rS rSr% SrS\S'   SS jrSrg)	r#   |   z2Class responsible for creating series description.r   r   c                R    [        U R                  5      nU" U R                  U5      $ r/   )select_describe_funcr   )r0   r    describe_funcs      r(   r%   SeriesDescriber.describe   s&    ,HH
 TXX{33r*   r4   N)r    r9   r7   r   )r:   r;   r<   r=   r>   __annotations__r%   r?   r4   r*   r(   r#   r#   |   s    <	K4r*   r#   c                  `   ^  \ rS rSr% SrS\S'           S	U 4S jjrS
S jrSS jrSr	U =r
$ )r$      a>  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                  > X l         X0l        UR                  S:X  a%  UR                  R                  S:X  a  [        S5      e[        TU ]  U5        g )N   r   z+Cannot describe a DataFrame without columns)r   r   r"   columnssize
ValueErrorsuperr1   )r0   r   r   r   	__class__s       r(   r1   DataFrameDescriber.__init__   sD     88q=S[[--2JKKr*   c           
     P   U R                  5       n/ nUR                  5        H'  u  pE[        U5      nUR                  U" XQ5      5        M)     [	        U5      n[        U Vs/ s H  oR                  USS9PM     snSSS9n	UR                  R                  5       U	l        U	$ s  snf )NF)copyr   )axissort)	_select_dataitemsrC   appendreorder_columnsr   reindexrK   rR   )
r0   r    dataldesc_seriesrD   	col_namesxds
             r(   r%   DataFrameDescriber.describe   s      " IA08MLLv;< & $E*	7<=u!YYyuY-u=

 LL%%'	 >s   "B#c                   U R                   c_  U R                  cR  [        R                  S/nU R                  R                  US9n[        UR                  5      S:X  a  U R                  nU$ U R                   S:X  a(  U R                  b  Sn[        U5      eU R                  nU$ U R                  R                  U R                   U R                  S9nU$ )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lenrK   rM   )r0   default_includerZ   msgs       r(   rU   DataFrameDescriber._select_data   s    LL t||';46IIz3JO88))/)BD4<< A%xx  \\U"||'B o%88D 	 88)) * D r*   )r   r   )r   r   r   str | Sequence[str] | Noner   rl   r7   r8   )r    r9   r7   r   )r7   r   )r:   r;   r<   r=   r>   rF   r1   r%   rU   r?   __classcell__)rO   s   @r(   r$   r$      sI    
 
N ,	
 , 
" r*   r$   c                    / n[        5       n[        S U  5       [        S9nU H5  nU H,  nXR;  d  M
  UR                  U5        UR	                  U5        M.     M7     U$ )z,Set a convenient order for rows for display.c              3  8   #    U  H  oR                   v   M     g 7fr/   )index).0r_   s     r(   	<genexpr>"reorder_columns.<locals>.<genexpr>   s     3UGGUs   )key)setsortedrh   addrW   )r[   names
seen_namesldesc_indexesidxnamesnames         r(   rX   rX      sY    E #J3U3=M!D%t$T"  "
 Lr*   c                   SSK Jn  [        U5      n/ SQU-   S/-   nU R                  5       U R	                  5       U R                  5       U R                  5       /U R                  U5      R                  5       -   U R                  5       /-   n[        U R                  [        5      (       ae  [        U R                  [        5      (       a;  U R                  R                  S:X  a  SnO\SSKn[        UR!                  5       5      nO>[#        5       nO3U R                  R                  S;   a  [$        R                  " S5      nOSnU" XTU R&                  US	9$ )
zDescribe 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rp   r|   dtype)pandasr   r   r   r   r   r   quantiletolistr   
isinstancer   r   r   kindpyarrowfloat64r   re   r|   )r]   r    r   formatted_percentiles
stat_indexr`   r   pas           r(   describe_numeric_1dr      s    .{;03HHE7RJ	

fjjlC
//+
&
-
-
/	0::<.	  &,,//fllJ//||  C'$"2::<0 NE			f	$!!FKKuEEr*   c                .   / SQnU R                  5       n[        X3S:g     5      nUS:  a   UR                  S   UR                  S   peSnO![        R
                  [        R
                  peSnU R                  5       XEU/nSSKJn	  U	" XU R                  US9$ )zDescribe series containing categorical data.

Parameters
----------
data : Series
    Series to be described.
percentiles_ignored : list-like of numbers
    Ignored, but in place to unify interface.
)r   uniquetopfreqr   Nobjectr~   r   )
value_countsrh   rp   ilocre   nanr   r   r   r|   )
rZ   percentiles_ignoredrx   	objcountscount_uniquer   r   r   r'   r   s
             r(   describe_categorical_1dr     s     /E!!#Iya01LaOOA&	q(9T FFBFFTjjlLt4F&DIIUCCr*   c           	        SS/nU R                  5       n[        X3S:g     5      nU R                  5       U/nSnUS:  a  UR                  S   UR                  S   pU R
                  R                  n	U R                  5       R                  R                  S5      n
[        U5      nUR                  b  U	b  UR                  U	5      nOUR                  U	5      nU/ SQ-  nUUU[        U
R                  5       U	S9[        U
R                  5       U	S9/-  nO,USS	/-  nU[         R"                  [         R"                  /-  nS
nSSKJn  U" XRU R(                  US9$ )zDescribe 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.
r   r   r   Ni8)r   r   firstlast)tzr   r   r   r~   r   )r   rh   r   rp   r   dtr   dropnavaluesviewr	   tzinfo
tz_converttz_localizer   r   re   r   r   r   r|   )rZ   r   rx   r   r   r'   r   r   r   r   asintr   s               r(   $describe_timestamp_as_categorical_1dr   "  sA    hE!!#Iya01L'+zz|\&BFEaOOA&	q(9TWWZZ$$))$/n::!bn..$C//"%C11eiikb)eiikb)	
 	
 	% 266266""&DIIUCCr*   c                   SSK Jn  [        U5      n/ SQU-   S/-   nU R                  5       U R	                  5       U R                  5       /U R                  U5      R                  5       -   U R                  5       /-   nU" XTU R                  S9$ )zDescribe series containing datetime64 dtype.

Parameters
----------
data : Series
    Series to be described.
percentiles : list-like of numbers
    The percentiles to include in the output.
r   r~   )r   r   r   r   )rp   r|   )
r   r   r   r   r   r   r   r   r   r|   )rZ   r    r   r   r   r`   s         r(   describe_timestamp_1dr   R  s     .{;),AAUGKJ	tyy{DHHJ/
--
$
+
+
-	.88:,	 
 !DII66r*   c                8   [        U R                  5      (       a  [        $ [        U 5      (       a  [        $ U R                  R
                  S:X  d  [        U R                  [        5      (       a  [        $ U R                  R
                  S:X  a  [        $ [        $ )zSelect proper function for describing series based on data type.

Parameters
----------
data : Series
    Series to be described.
Mr   )	r   r   r   r   r   r   r   r   r   )rZ   s    r(   rC   rC   j  sl     TZZ  &&	$		""	C	:djj/#J#J$$	C	""&&r*   c                >   U c  [         R                  " / SQ5      $ [        U 5      n [        U 5        SU ;  a  U R	                  S5        [         R
                  " U 5      n [         R                  " U 5      nU c   e[        U5      [        U 5      :  a  [        S5      eU$ )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)	re   arraylistr   rW   asarrayr   rh   rM   )r    unique_pctss     r(   r!   r!     s     xx)** {#K $ +3**[)K ))K(K"""
;#k**@AAr*   )
r   r   r   rl   r   rl   r    #Sequence[float] | np.ndarray | Noner7   r   )r[   zSequence[Series]r7   zlist[Hashable])r]   r   r    Sequence[float]r7   r   )rZ   r   r   r   r7   r   )rZ   r   r    r   r7   r   )rZ   r   r7   r   )r    r   r7   znpt.NDArray[np.float64])2r>   
__future__r   abcr   r   typingr   r   r   numpyre   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$   rX   r   r   r   r   rC   r!   r4   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`70'
'', 4  r*   