Ë
    *�£j:)  ã                  óv  — d Z ddlmZ ddlmZmZ ddlmZmZ ddl	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 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„Z.y)#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                óØ   — 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         ú>C:\FundamentalWorkbench\vendor\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.ndarrayr3   r2   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r/   r   r$   r1   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   r5   r3   r   )r6   r7   r8   r9   Ú__annotations__r$   r1   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Úsuperr/   )r.   r   r   r   Ú	__class__s       €r'   r/   zDataFrameDescriber.__init__—   sH   ø€ ð ˆŒØˆŒà�8‰8�qŠ=˜SŸ[™[×-Ñ-°Ò2ÜÐJÓKÐKä‰Ñ˜Õr)   c                óV  — | j                  «       }g }|j                  «       D ](  \  }}t        |«      }|j                   |||«      «       Œ* t	        |«      }t        |D �cg c]  }|j                  |«      ‘Œ c}ddd¬«      }	|j                  j                  «       |	_        |	S c c}w )Nr   TF)ÚaxisÚignore_indexÚsort)	Ú_select_dataÚitemsr<   ÚappendÚreorder_columnsr   ÚreindexrB   Úcopy)
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Ó*ˆ	ÜÙ+0Ó1©5 aˆQ�Y‰Y�yÕ!¨5Ñ1ØØØô	
ˆð —L‘L×%Ñ%Ó'ˆŒ	Øˆùò 2s   Á"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                  ¬«      }t        |j                  «      dk(  rd}t        |«      ‚|S )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ÚlenrB   rD   )r.   Údefault_includerQ   Úmsgs       r'   rK   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ô �4—<‘<Ó  AÒ%ØT�Ü  “oÐ%Øˆr)   )r   r   r   ústr | Sequence[str] | Noner   ra   r3   r4   )r   r5   r3   r   )r3   r   )	r6   r7   r8   r9   r>   r/   r$   rK   Ú__classcell__)rF   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©U¨˜AŸG�G©Uùs   ‚)Úkey)ÚsetÚsortedr^   ÚaddrM   )rR   ÚnamesÚ
seen_namesÚldesc_indexesÚidxnamesÚnames         r'   rN   rN   Ð   s[   € à€EÜ #£€JÜÑ3©UÓ3¼Ô=€MÛ!ˆÛˆDØ˜:Ò%Ø—‘˜tÔ$Ø—‘˜TÕ"ñ ð "ð
 €Lr)   c                ó¶  — ddl m} t        |«      }t        |«      dk(  rg }n| j	                  |«      j                  «       }ddddg|¢d‘}| j                  «       | j                  «       | j                  «       | j                  «       g|¢| j                  «       ‘}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   r^   ÚquantileÚtolistrs   rt   ru   rv   rw   Ú
isinstancer|   r   r   ÚkindÚpyarrowÚfloat64r   r[   rp   )	rT   r   r   Úformatted_percentilesÚ	quantilesÚ
stat_indexrW   r|   Úpas	            r'   Údescribe_numeric_1drˆ   Ý   s"  € õ ä.¨{Ó;Ðä
ˆ;Ó˜1ÒØ‰	à—O‘O KÓ0×7Ñ7Ó9ˆ	à˜6 5¨%ÐOÐ2GÐOÈÐO€Jà�‰‹Ø�‰‹Ø�
‰
‹Ø�
‰
‹ð		ð
 
ð	ð 	�
‰
‹ð	€Aô �&—,‘,¤Ô/Ü�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l m} t        |«      }dddg|¢d‘}| j                  «       | j	                  «       | j                  «       g| j                  |«      j                  «       ¢| j                  «       ‘} |||| 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–   .  sŒ   € õ ä.¨{Ó;Ðà˜6 5ÐHÐ+@ÐHÀ%ÐH€Jà�
‰
‹Ø�	‰	‹Ø�‰‹
ð	ð 
�‰�{Ó	#×	*Ñ	*Ó	,ð		ð
 	�‰‹
ð	€Añ �!˜:¨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<   H  sc   € ô �T—Z‘ZÔ Ü&Ð&Ü	˜$Ô	Ü"Ð"Ø	�‰�‰˜CÒ	¤:¨d¯j©j¼/Ô#JÜ$Ð$Ø	�‰�‰˜CÒ	Ü"Ð"ä&Ð&r)   c                óî   — | €t        j                  g d¢«      S t        j                  | «      } t        | «       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      à?g      è?z%percentiles cannot contain duplicates)r[   ÚarrayÚasarrayr   rŠ   r^   rD   )r   Úunique_pctss     r'   r    r    ^  sr   € ð ÐÜ�x‰xÒ)Ó*Ð*ä—*‘*˜[Ó)€Kô ˜Ô$ô —)‘)˜KÓ(€KØÐ"Ð"Ð"Ü
ˆ;Óœ#˜kÓ*Ò*ÜÐ@ÓAÐAàÐr)   )
r   r	   r   ra   r   ra   r   ú#Sequence[float] | np.ndarray | Noner3   r	   )rR   zSequence[Series]r3   zlist[Hashable])rT   r   r   úSequence[float]r3   r   )rQ   r   r‘   rž   r3   r   )rQ   r   r   rž   r3   r   )rQ   r   r3   r   )r   r�   r3   znpt.NDArray[np.float64])/r9   Ú
__future__r   Úabcr   r   Útypingr   r   Únumpyr[   Ú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#   rN   rˆ   r”   r–   r<   r    r1   r)   r'   Ú<module>r«      s  ðñõ #÷÷ó
 ÷ñ õ
 8÷÷ñ õ 5Ý -å 7á÷ñ ÷ð+"à	ð+"ð (ð+"ð (ð	+"ð
 5ð+"ð ó+"ô\˜sô ô.	4Ð.ô 	4ôEÐ1ô EóP
ó.FðbDØ
ðDà(ðDð óDó@7ð4'Ø
ð'àó'ð,Ø4ðàôr)   