
    Q/PhW                        d Z ddlmZmZmZ ddlmZmZmZm	Z	 ddl
ZddlZddlmZ ddlmZ ddlmZ dRd	ed
edefdZe G d de                      Z G d d          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z  G d d e          Z! G d! d"e          Z" G d# d$e          Z# G d% d&e          Z$ G d' d(e          Z% G d) d*e          Z& G d+ d,e          Z' G d- d.e          Z( G d/ d0e          Z) G d1 d2e          Z* G d3 d4e          Z+ G d5 d6e          Z, G d7 d8e          Z-d9e.dee         fd:Z/d;ed<e.dee         fd=Z0d;ed<e.dee         fd>Z1d;ed<e.dee         fd?Z2d;ed<e.dee         fd@Z3d<e.dee         fdAZ4d<e.dee         fdBZ5dee         fdCZ6d;edDedEe.dee         fdFZ7d;edGe.dee         fdHZ8d;edIe.dJe.dGe.dee         f
dKZ9d	edefdLZ:dMedNe;defdOZ<dPej=        defdQZ>dS )SzLogic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations).    )Enumautounique)DictListOptionalSetN)Settings)perform_check_correlation)get_alert_stylesTvalue
edge_casesreturnc                     |rt          | d          dk    r| dk    rdS |rt          | d          dk    r| dk     rdS | dz  ddS )	zFormat a ratio as a percentage.

    Args:
        edge_cases: Check for edge cases?
        value: The ratio.

    Returns:
        The percentage with 1 point precision.
       r   z< 0.1%   z> 99.9%d   z2.1f%)round)r   r   s     \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/ydata_profiling/model/alerts.pyfmt_percentr      sh      eE1oo**uqyyx eE1oo**uqyyyCi    c                      e Zd ZdZ e            Z	  e            Z	  e            Z	  e            Z	  e            Z		  e            Z
	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            Z	  e            ZdS )	AlertTypezAlert typesN)__name__
__module____qualname____doc__r   CONSTANTZEROSHIGH_CORRELATIONHIGH_CARDINALITYUNSUPPORTED
DUPLICATESNEAR_DUPLICATESSKEWED	IMBALANCEMISSINGINFINITE	TYPE_DATEUNIQUEDIRTY_CATEGORYCONSTANT_LENGTHREJECTEDUNIFORMNON_STATIONARYSEASONALEMPTY r   r   r   r   !   s-       tvvH-DFFE'tvv-tvv/$&&K'J,dffO,TVVF)I&dffG0tvvH1IITVVF*TVVN{dffO.tvvHYdffG0TVVN2tvvH1DFFE!!r   r   c                       e Zd ZU dZdZee         ed<   	 	 	 	 ddedee	         dee         dee
         d	ef
d
Zedefd            Zedee         fd            ZdefdZdefdZd ZdS )Alertz'An alert object (type, values, column).N
_anchor_idF
alert_typevaluescolumn_namefieldsis_emptyc                     |pt                      | _        || _        |pi | _        || _        || _        t                      | _        d S N)setr:   r7   r8   r9   	_is_emptyr   _styles)selfr7   r8   r9   r:   r;   s         r   __init__zAlert.__init__g   sE     o$l&!'))r   r   c                 f    | j         j                            dd                                          S )N_ )r7   namereplace
capitalizerA   s    r   alert_type_namezAlert.alert_type_namev   s)    #++C55@@BBBr   c                 j    | j         &t          t          | j                            | _         | j         S r=   )r6   strhashr9   rI   s    r   	anchor_idzAlert.anchor_idz   s,    ?"!$t'7"8"899DOr   c                 t   | j                             | j        j                                        d          }d}| j        t
          j        k    rZ| j        St          | j        d                   }d	                    | j        d                   }| j        d         }d| d| d| d	}d
| d| d| j
         dS )N	secondary r:   z, corrz[data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="This variable has a high z correlation with z	 fields: "z<span class="badge text-bg-z" >z</span>)r@   getr7   rF   lowerr   r!   r8   lenjoinrJ   )rA   stylehintnumtitlerR   s         r   fmtz	Alert.fmt   s      !5!;!;!=!={KK?i888T[=Tdk(+,,CIIdk(344E;v&D `qu  `  `  JM  `  `  X]  `  `  `D X%WW4WW$:NWWW	
r   c                 8    | j         j        }| j        }d| d| S )zlReturn a human level description of the alert.

        Returns:
            str: alert description
        [z] alert on column )r7   rF   r9   )rA   r7   columns      r   _get_descriptionzAlert._get_description   s,     _)
!9:99999r   c                 *    |                                  S r=   )ra   rI   s    r   __repr__zAlert.__repr__   s    $$&&&r   )NNNF)r   r   r   r   r6   r   rL   __annotations__r   r   r	   boolrB   propertyrJ   rN   r]   ra   rc   r3   r   r   r5   r5   b   s/        11 $J$$$
 "&%) $* ** * c]	*
 * * * * * C C C C XC 8C=    X

S 
 
 
 
:# : : : :' ' ' ' 'r   r5   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
ConstantLengthAlertNFr8   r9   r;   c                 l    t                                          t          j        ||ddh|           d S )Ncomposition_min_lengthcomposition_max_lengthr7   r8   r9   r:   r;   )superrB   r   r-   rA   r8   r9   r;   	__class__s       r   rB   zConstantLengthAlert.__init__   sH     	 0#,.FG 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   z] has a constant lengthr9   rI   s    r   ra   z$ConstantLengthAlert._get_description   s    <4#<<<<r   NNF
r   r   r   r   r   rL   re   rB   ra   __classcell__ro   s   @r   rh   rh      s         "&%)	
 

 c]
 	
 
 
 
 
 
=# = = = = = = = =r   rh   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
ConstantAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S N
n_distinctrl   )rm   rB   r   r   rn   s       r   rB   zConstantAlert.__init__   sD     	 )# > 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   z] has a constant valuerq   rI   s    r   ra   zConstantAlert._get_description   s    ;4#;;;;r   rr   rs   ru   s   @r   rw   rw      s         "&%)	
 

 c]
 	
 
 
 
 
 
<# < < < < < < < <r   rw   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
DuplicatesAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S )Nn_duplicatesrl   )rm   rB   r   r$   rn   s       r   rB   zDuplicatesAlert.__init__   sE     	 +#"# 	 	
 	
 	
 	
 	
r   r   c                 l    | j         ,d| j         d          dt          | j         d                    dS dS )NDataset has r    (p_duplicatesz) duplicate rowszDataset has no duplicated rowsr8   r   rI   s    r   ra   z DuplicatesAlert._get_description   s@    ;"{$+n"={{T[YgMhAiAi{{{{33r   rr   rs   ru   s   @r   r}   r}      s         "&%)	
 

 c]
 	
 
 
 
 
 
4# 4 4 4 4 4 4 4 4r   r}   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
NearDuplicatesAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S )Nn_near_dupsrl   )rm   rB   r   r%   rn   s       r   rB   zNearDuplicatesAlert.__init__   sD     	 0#!? 	 	
 	
 	
 	
 	
r   r   c                 l    | j         ,d| j         d          dt          | j         d                    dS dS )Nr   r   r   p_near_dupsz) near duplicate rowsz#Dataset has no near duplicated rowsr   rI   s    r   ra   z$NearDuplicatesAlert._get_description   s@    ;"~$+m"<~~DKXeLf@g@g~~~~88r   rr   rs   ru   s   @r   r   r      s         "&%)	
 

 c]
 	
 
 
 
 
 
9# 9 9 9 9 9 9 9 9r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )

EmptyAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S )Nnrl   )rm   rB   r   r2   rn   s       r   rB   zEmptyAlert.__init__   sC     	 #5 	 	
 	
 	
 	
 	
r   r   c                     dS )NzDataset is emptyr3   rI   s    r   ra   zEmptyAlert._get_description   s    !!r   rr   rs   ru   s   @r   r   r      s         "&%)	
 

 c]
 	
 
 
 
 
 
"# " " " " " " " "r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
HighCardinalityAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S ry   )rm   rB   r   r"   rn   s       r   rB   zHighCardinalityAlert.__init__  sD     	 1# > 	 	
 	
 	
 	
 	
r   r   c           	          | j         5d| j         d| j         d          dt          | j         d                    dS d| j         dS )Nr_   ] has rz   r   
p_distinctz) distinct valuesz] has a high cardinalityr8   r9   r   rI   s    r   ra   z%HighCardinalityAlert._get_description  s|    ;" Gt'  G  Gt{</H  G  G  G[Y]YdeqYrMsMs  G  G  G  GAt'AAAAr   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
B# B B B B B B B Br   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
DirtyCategoryAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S )Nn_fuzzy_valsrl   )rm   rB   r   r,   rn   s       r   rB   zDirtyCategoryAlert.__init__  sE     	 /#"# 	 	
 	
 	
 	
 	
r   r   c           	          | j         4d| j         d| j         d          dt          | j         d                    dS d| j         dS )Nr_   r   r   z fuzzy values: p_fuzzy_valsz per categoryz] no dirty categories values.r   rI   s    r   ra   z#DirtyCategoryAlert._get_description'  s    ;" St'  S  St{>/J  S  S[fgkgr  tB  hC  \D  \D  S  S  S  SFt'FFFFr   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
G# G G G G G G G Gr   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
HighCorrelationAlertNFr8   r9   r;   c                 f    t                                          t          j        |||           d S N)r7   r8   r9   r;   )rm   rB   r   r!   rn   s       r   rB   zHighCorrelationAlert.__init__/  s?     	 1#	 	 	
 	
 	
 	
 	
r   r   c                 
   | j         pd| j         d| j         d          d| j         d         d          d}t          | j         d                   dk    r$|d	t          | j         d                   dz
   d
z  }nd| j         dS |S )Nr_   z] is highly rR   z correlated with [r:   r   ]r   z and z other fieldsz0] has a high correlation with one or more colums)r8   r9   rW   rA   descriptions     r   ra   z%HighCorrelationAlert._get_description<  s    ;"~d.~~DK<O~~cgcnowcxyzc{~~~K4;x())A--Ts4;x+@'A'AA'ETTTT WD$VVV r   rr   rs   ru   s   @r   r   r   .  s         "&%)	
 

 c]
 	
 
 
 
 
 
	# 	 	 	 	 	 	 	 	r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
ImbalanceAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S )N	imbalancerl   )rm   rB   r   r'   rn   s       r   rB   zImbalanceAlert.__init__I  sD     	 *#= 	 	
 	
 	
 	
 	
r   r   c                 R    d| j          d}| j        |d| j        d          dz   S |S )Nr_   z] is highly imbalancedr   r   )r9   r8   r   s     r   ra   zImbalanceAlert._get_descriptionW  sA    B$*BBB;"!Adk+&>!A!A!AAAr   rr   rs   ru   s   @r   r   r   H           "&%)	
 

 c]
 	
 
 
 
 
 
#        r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
InfiniteAlertNFr8   r9   r;   c                 l    t                                          t          j        ||ddh|           d S )N
p_infinite
n_infiniterl   )rm   rB   r   r)   rn   s       r   rB   zInfiniteAlert.__init__`  sG     	 )# ,/ 	 	
 	
 	
 	
 	
r   r   c           	          | j         4d| j         d| j         d          dt          | j         d                    dS d| j         dS )Nr_   r   r   r   r   z) infinite valuesz] has infinite valuesr   rI   s    r   ra   zInfiniteAlert._get_descriptionn  sv    ;" Ft'  F  Ft{</H  F  FKX\XcdpXqLrLr  F  F  F  F>t'>>>>r   rr   rs   ru   s   @r   r   r   _  s         "&%)	
 

 c]
 	
 
 
 
 
 
?# ? ? ? ? ? ? ? ?r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
MissingAlertNFr8   r9   r;   c                 l    t                                          t          j        ||ddh|           d S )N	p_missing	n_missingrl   )rm   rB   r   r(   rn   s       r   rB   zMissingAlert.__init__v  sG     	 (#- 	 	
 	
 	
 	
 	
r   r   c           	          | j         4d| j         d| j         d          dt          | j         d                    dS d| j         dS )Nr_   z] r   r   r   z) missing valuesz] has missing valuesr   rI   s    r   ra   zMissingAlert._get_description  s[    ;"~t'~~4;{+C~~{SWS^_jSkGlGl~~~~=t'====r   rr   rs   ru   s   @r   r   r   u  s         "&%)	
 

 c]
 	
 
 
 
 
 
># > > > > > > > >r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
NonStationaryAlertNFr8   r9   r;   c                 f    t                                          t          j        |||           d S r   )rm   rB   r   r0   rn   s       r   rB   zNonStationaryAlert.__init__  s?     	 /#	 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   z] is non stationaryrq   rI   s    r   ra   z#NonStationaryAlert._get_description      84#8888r   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
9# 9 9 9 9 9 9 9 9r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
SeasonalAlertNFr8   r9   r;   c                 f    t                                          t          j        |||           d S r   )rm   rB   r   r1   rn   s       r   rB   zSeasonalAlert.__init__  ?     	 )#	 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   z] is seasonalrq   rI   s    r   ra   zSeasonalAlert._get_description  s    24#2222r   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
3# 3 3 3 3 3 3 3 3r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
SkewedAlertNFr8   r9   r;   c                 j    t                                          t          j        ||dh|           d S )Nskewnessrl   )rm   rB   r   r&   rn   s       r   rB   zSkewedAlert.__init__  sD     	 '#< 	 	
 	
 	
 	
 	
r   r   c                 R    d| j          d}| j        |d| j        d          dz   S |S )Nr_   z] is highly skewedu   (γ1 = r   r   r   r   s     r   ra   zSkewedAlert._get_description  sA    >$*>>>;"!It{:/F!I!I!IIIr   rr   rs   ru   s   @r   r   r     r   r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
TypeDateAlertNFr8   r9   r;   c                 f    t                                          t          j        |||           d S r   )rm   rB   r   r*   rn   s       r   rB   zTypeDateAlert.__init__  s?     	 *#	 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   zY] only contains datetime values, but is categorical. Consider applying `pd.to_datetime()`rq   rI   s    r   ra   zTypeDateAlert._get_description  s    ~4#~~~~r   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
#        r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
UniformAlertNFr8   r9   r;   c                 f    t                                          t          j        |||           d S r   )rm   rB   r   r/   rn   s       r   rB   zUniformAlert.__init__  s?     	 (#	 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   z] is uniformly distributedrq   rI   s    r   ra   zUniformAlert._get_description  s    ?4#????r   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
@# @ @ @ @ @ @ @ @r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
UniqueAlertNFr8   r9   r;   c                 l    t                                          t          j        ||h d|           d S )N>   n_uniquep_uniquerz   r   rl   )rm   rB   r   r+   rn   s       r   rB   zUniqueAlert.__init__  sH     	 '#GGG 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   z] has unique valuesrq   rI   s    r   ra   zUniqueAlert._get_description  r   r   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
9# 9 9 9 9 9 9 9 9r   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
UnsupportedAlertNFr8   r9   r;   c                 f    t                                          t          j        |||           d S r   )rm   rB   r   r#   rn   s       r   rB   zUnsupportedAlert.__init__  s?     	 ,#	 	 	
 	
 	
 	
 	
r   r   c                     d| j          dS )Nr_   zH] is an unsupported type, check if it needs cleaning or further analysisrq   rI   s    r   ra   z!UnsupportedAlert._get_description  s    m4#mmmmr   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
n# n n n n n n n nr   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )

ZerosAlertNFr8   r9   r;   c                 l    t                                          t          j        ||ddh|           d S )Nn_zerosp_zerosrl   )rm   rB   r   r    rn   s       r   rB   zZerosAlert.__init__  sF     	 #y) 	 	
 	
 	
 	
 	
r   r   c           	          | j         4d| j         d| j         d          dt          | j         d                    dS d| j         dS )Nr_   r   r   r   r   z) zerosz] has predominantly zerosr   rI   s    r   ra   zZerosAlert._get_description  s[    ;"ut'uut{9/EuuUYU`ajUkIlIluuuuBt'BBBBr   rr   rs   ru   s   @r   r   r     s         "&%)	
 

 c]
 	
 
 
 
 
 
C# C C C C C C C Cr   r   c                   X     e Zd Z	 	 	 d	dee         dee         def fdZdefdZ xZ	S )
RejectedAlertNFr8   r9   r;   c                 f    t                                          t          j        |||           d S r   )rm   rB   r   r.   rn   s       r   rB   zRejectedAlert.__init__&  r   r   r   c                     d| j          dS )Nr_   z] was rejectedrq   rI   s    r   ra   zRejectedAlert._get_description3  s    34#3333r   rr   rs   ru   s   @r   r   r   %  s         "&%)	
 

 c]
 	
 
 
 
 
 
4# 4 4 4 4 4 4 4 4r   r   tablec                    g }t          |                     dt          j                            r#|                    t          |                      | d         dk    r#|                    t          |                      |S )zChecks the overall dataset for alerts.

    Args:
        table: Overall dataset statistics.

    Returns:
        A list of alerts.
    r   )r8   r   r   )alert_valuerU   npnanappendr}   r   )r   alertss     r   check_table_alertsr   7  s     F599^RV4455 
  	
 	
 	

 SzQ  	
 	
 	

 Mr   configsummaryc                     g }t          |d         | j        j        j                  r"|                    t          |                     t          |d                   r"|                    t          |                     t          |d                   r"|                    t          |                     d|v rB|d         d         | j        j        j	        k    r!|                    t                                 |S )Nr   r   r   chi_squaredpvalue)skewness_alertvarsr[   skewness_thresholdr   r   r   r   r   chi_squared_thresholdr   r   r   r   s      r   numeric_alertsr   P  s    F gj)6;?+MNN ,k'**+++ 7<()) .mG,,--- 79%&& +j))*** 	  M"8,v{/TTTlnn%%%Mr   c                     t          | |          }|d         s!|                    t                                 |d         r!|                    t                                 |S )N
stationaryseasonal)r   r   r   r   r   s      r   timeseries_alertsr   h  s_    (99F<  ,(**+++z 'moo&&&Mr   c                    g }|                     dt          j                  | j        j        j        k    r"|                    t          |                     d|v rB|d         d         | j        j        j        k    r!|                    t                                 |                     d          r!|                    t                                 d|v r3|d         |d         k    r!|                    t                                 d|v r=|d         | j        j        j        k    r"|                    t          |                     |S )	Nrz   r   r   date_warningcomposition
min_length
max_lengthr   )rU   r   r   r   catcardinality_thresholdr   r   r   r   r   rh   imbalance_thresholdr   r   s      r   categorical_alertsr  t  s,   F {{<((6;?+PPP*733444 	  M"8,v{/TTTlnn%%%{{>"" 'moo&&& GL$9W\=R$R$R)++,,, 	wK 6;?#FFFnW--...Mr   c                     g }d|v r<|d         | j         j        j        k    r!|                    t	                                 |S )Nr   )r   re   r  r   r   r   s      r   boolean_alertsr    sI    F 	wK 6;#3#GGGn&&'''Mr   c                 v    g }t          | d                   r!|                    t                                 |S )Nr   )r   r   r   r   r   s     r   generic_alertsr    s9    F 7;'(( &lnn%%%Mr   c                 ,   g }|                      dt          j                  | d         k    r!|                    t	                                 |                      dt          j                  dk    r"|                    t          |                      |S )Nrz   r   r   )rU   r   r   r   r   rw   r  s     r   supported_alertsr
    sv    F{{<((GCL88kmm$$${{<((A--mG,,---Mr   c                  >    t                      t                      g} | S r=   )r   r   )r   s    r   unsupported_alertsr    s     F Mr   colr   c                    g }|t          |          z  }|d         dk    r|t                      z  }n|t          |          z  }|d         dk    r|t          | |          z  }|d         dk    r|t	          | |          z  }|d         dk    r|t          | |          z  }|d         dk    r|t          | |          z  }t          t          |                    D ]}|||         _	        |||         _
        |S )zChecks individual variables for alerts.

    Args:
        col: The column name that is checked.
        description: The series description.

    Returns:
        A list of alerts.
    typeUnsupportedCategoricalNumeric
TimeSeriesBoolean)r  r  r
  r  r   r   r  rangerW   r9   r8   )r   r  r   r   idxs        r   check_variable_alertsr    s     F
n[)))F6m++$&&&";///v-//(===Fv)++nV[999Fv,..'<<<Fv)++nV[999FS[[!! ) )"%s(sMr   correlationsc           
         g }i }|                                 D ]\  }}| j        |         j        r| j        |         j        }t	          ||          }|                                 D ]M\  }}	t          |	                              t          |                    |g                                |	||<   Nt          |          dk    rA|                                 D ],\  }}	|	                    t          |d|	d                     -|S )Nr   overall)rR   r:   r   )itemsr  warn_high_correlations	thresholdr   r>   updaterU   rW   r   r   )
r   r  r   correlations_consolidatedrR   matrixr  correlated_mappingr  r:   s
             r   check_correlation_alertsr"    s5   F "$**,, 8 8ft$; 	8+D1;I!:69!M!M17799 8 8VF""3'9'='=c2'F'F#G#GHHH17)#..
$%%))4::<< 	 	KCMM$ #$-@@      Mr   table_statsseries_descriptionc                     t          |          }|                                D ]\  }}|t          | ||          z  }|t          | |          z  }|                    d            |S )Nc                 *    t          | j                  S r=   )rL   r7   )alerts    r   <lambda>zget_alerts.<locals>.<lambda>  s    #e&6"7"7 r   )key)r   r  r  r"  sort)r   r#  r$  r  r   r  r   s          r   
get_alertsr+    s~     -[99F.4466 B B['[AAA
&v|<<<F
KK77K888Mr   c                 8    t          j        |            o| dk    S )Ng{Gz?pdisna)r   s    r   r   r     s    wu~~.%$,.r   vr  c                 J    t          j        |            o| d|z  k     p| |k    S )Nr-  )r0  r  s     r   r   r      s)    wqzz>EqBN3Dq9}Er   seriesc                 Z    ddl m}m} 	 |                     |           dS # |$ r Y dS w xY w)Nr   )ParserErrorparseTF)dateutil.parserr5  r6  apply)r3  r5  r6  s      r   type_date_alertr9    s\    22222222U t    uus   ! **)T)?r   enumr   r   r   typingr   r   r   r	   numpyr   pandasr.  ydata_profiling.configr
   "ydata_profiling.model.correlationsr   ydata_profiling.utils.stylesr   floatre   rL   r   r   r5   rh   rw   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   dictr   r   r   r  r  r  r
  r  r  r"  r+  r   intr   Seriesr9  r3   r   r   <module>rE     s    $ # # # # # # # # # , , , , , , , , , , , ,         + + + + + + H H H H H H 9 9 9 9 9 9   u  $  #        $ =" =" =" =" =" =" =" ="@8' 8' 8' 8' 8' 8' 8' 8'v= = = = =% = = =&< < < < <E < < <&4 4 4 4 4e 4 4 4,9 9 9 9 9% 9 9 9," " " " " " " "&B B B B B5 B B B,G G G G G G G G,    5   4    U   .? ? ? ? ?E ? ? ?,> > > > >5 > > >,9 9 9 9 9 9 9 9$3 3 3 3 3E 3 3 3$    %   .    E   $@ @ @ @ @5 @ @ @$9 9 9 9 9% 9 9 9&n n n n nu n n n$C C C C C C C C,4 4 4 4 4E 4 4 4$d tE{    28 d tE{    0	h 	 	$u+ 	 	 	 	x $ 4;    :8 d tE{    D T%[    d tE{    DK    (  4 DQVK    DX T d5k    .#'=AQU	%[   /u / / / / /Fe F F F F F FBI $      r   