
    I j:)                       S r SSKJr  SSKJrJr  SSKJrJr  SSK	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 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r.g)#z
Module responsible for execution of NDFrame.describe() method.

Method NDFrame.describe() delegates actual execution to function describe_ndframe().
    )annotations)ABCabstractmethod)TYPE_CHECKINGcastN)DtypeObjNDFrameTnpt)validate_percentile)is_bool_dtypeis_numeric_dtype)
ArrowDtypeDatetimeTZDtypeExtensionDtype)Float64Dtype)concat)format_percentiles)Callable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         m/root/GenerationalWealth/GenerationalWealth/venv/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 )r/   r   s     r'   r$   !NDFrameDescriberAbstract.describeq   s    r)   r   N)r   DataFrame | SeriesreturnNone)r   Sequence[float] | np.ndarrayr6   r5   )	__name__
__module____qualname____firstlineno____doc__r0   r   r$   __static_attributes__r3   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   )r/   r   describe_funcs      r'   r$   SeriesDescriber.describe   s&    ,HH
 TXX{33r)   r3   N)r   r8   r6   r   )r9   r:   r;   r<   r=   __annotations__r$   r>   r3   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superr0   )r/   r   r   r   	__class__s       r'   r0   DataFrameDescriber.__init__   sD     88q=S[[--2JKKr)   c                T   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5      PM     snSSSS9n	UR                  R                  5       U	l        U	$ s  snf )Nr   TF)axisignore_indexsort)	_select_dataitemsrB   appendreorder_columnsr   reindexrJ   copy)
r/   r   dataldesc_seriesrC   	col_namesxds
             r'   r$   DataFrameDescriber.describe   s      " IA08MLLv;< & $E*	+015aYYy!51	
 LL%%'	 2s   "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R                  5      S:X  a  Sn[        U5      eU$ )zSelect columns to be described.datetime)r   r   allz*exclude must be None when include is 'all')r   r   z<No columns match the specified include or exclude data types)	r   r   npnumberr   select_dtypeslenrJ   rL   )r/   default_includerZ   msgs       r'   rT   DataFrameDescriber._select_data   s    LL t||';46IIz3JO88))/)BD4<< A%xx  \\U"||'B o%88D  88)) * D 4<< A%T o%r)   )r   r   )r   r   r   str | Sequence[str] | Noner   rl   r6   r7   )r   r8   r6   r   )r6   r   )r9   r:   r;   r<   r=   rE   r0   r$   rT   r>   __classcell__)rN   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   addrV   )r[   names
seen_namesldesc_indexesidxnamesnames         r'   rW   rW      sY    E #J3U3=M!D%t$T"  "
 Lr)   c                   SSK Jn  [        U5      n[        U5      S:X  a  / nOU R	                  U5      R                  5       nSSSS/UQSPnU R                  5       U R                  5       U R                  5       U R                  5       /UQU R                  5       P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" XeU 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   rh   quantiletolistr   r   r   r   r   
isinstancer   r   r   kindpyarrowfloat64r   re   r|   )	r]   r   r   formatted_percentiles	quantiles
stat_indexr`   r   pas	            r'   describe_numeric_1dr      s&    .{;
;1	OOK0779	65%O2GOOJ



		
 
	 	

	A &,,//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K Jn  [        U5      nSSS/UQSPnU R                  5       U R	                  5       U R                  5       /U R                  U5      R                  5       QU R                  5       P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   .  s     .{;65H+@H%HJ

		
	 
{	#	*	*	,		
 	
	A !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'   rB   rB   H  sl     TZZ  &&	$		""	C	:djj/#J#J$$	C	""&&r)   c                    U c  [         R                  " / SQ5      $ [         R                  " U 5      n [        U 5        [         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      ?g      ?z%percentiles cannot contain duplicates)re   arrayasarrayr   r   rh   rL   )r   unique_pctss     r'   r    r    ^  sr     xx)****[)K $ ))K(K"""
;#k**@AAr)   )
r   r	   r   rl   r   rl   r   #Sequence[float] | np.ndarray | Noner6   r	   )r[   zSequence[Series]r6   zlist[Hashable])r]   r   r   Sequence[float]r6   r   )rZ   r   r   r   r6   r   )rZ   r   r   r   r6   r   )rZ   r   r6   r   )r   r   r6   znpt.NDArray[np.float64])/r=   
__future__r   abcr   r   typingr   r   numpyre   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"   r#   rW   r   r   r   rB   r    r3   r)   r'   <module>r      s   #
  
 8  5 - 7 +"	+" (+" (	+"
 5+" +"\s .	4. 	4E1 EP
.FbD
D(D D@74'
'',4r)   