
    ~i                    R   d dl 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mZmZmZmZ d dl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c mZ  d	Z! e"eeeee
          Zg dg dz   g dz   g dz   Z#g dZ$g dZ%g dZ&e#e$z   e%z   e&z   Z'ej(        ej)        ej*        ej+        ej,        ej-        gZ.e.ej/        ej0        ej1        gz  Z. G d de2          Z3 e3            Z4[3da5d Z6d Z7 edg d          Z8 edg d          Z9d Z:d Z;de j<        de=de>fdZ?d e j@        de j@        fd!ZAde=fd"ZBd# ZCd$ ZDd% ZEd& ZFd' ZGd( ZHd) ZId* ZJd+ ZKd, ZLd- ZMd. ZNd/ ZOd0 ZPd1 ZQd2 ZRd3 ZSd4 ZTd5 ZUd6 ZVd7 ZWd8 ZXd9 ZYdEd:ZZd; Z[d< Z\de j<        ddfd=Z]d> Z^d? Z_d@ Z`dA ZadB ZbdEdCZcdD ZddS )F    N)
namedtupleOrderedDict   )IdentityMapConstantRange)olslowessrolling	expandingewm)ColorscaleValidator)qualitative
sequential)make_subplots_set_trace_grid_reference_subplot_type_for_trace_typepx_no_color_constant)r
   r   r   r   r	   )basexyzabcrthetasizex_startx_end)
hover_nametextnamesvaluesparents
wide_cross)idserror_xerror_x_minuserror_yerror_y_minuserror_z)error_z_minuslatlon	locationsanimation_group)
dimensionscustom_data
hover_datapathwide_variable)animation_frame	facet_row	facet_col
line_group)colorsymbol	line_dashpattern_shapec                   "    e Zd Zg dZd Zd ZdS )
PxDefaultstemplatewidthheightcolor_discrete_sequencecolor_discrete_mapcolor_continuous_scalesymbol_sequence
symbol_mapline_dash_sequenceline_dash_mappattern_shape_sequencepattern_shape_mapsize_maxcategory_orderslabelsc                 .    |                                   d S N)resetselfs    H/home/jrussi/.local/lib/python3.11/site-packages/plotly/express/_core.py__init__zPxDefaults.__init__I   s    

    c                     d | _         d | _        d | _        d | _        i | _        d | _        d | _        i | _        d | _        i | _	        d | _
        i | _        d| _        i | _        i | _        d S )N   rA   rT   s    rV   rS   zPxDefaults.resetL   sx    
'+$"$&*##"&&*#!#!rX   N)__name__
__module____qualname__	__slots__rW   rS    rX   rV   r@   r@   6   sC          I$      rX   r@   c                 
    | a dS )z
    Arguments:
        token: A Mapbox token to be used in `plotly.express.scatter_mapbox` and         `plotly.express.line_mapbox` figures. See         https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for more details
    N)MAPBOX_TOKEN)tokens    rV   set_mapbox_access_tokenrc   e   s     LLLrX   c                     | j         S )a  
    Extracts fit statistics for trendlines (when applied to figures generated with
    the `trendline` argument set to `"ols"`).

    Arguments:
        fig: the output of a `plotly.express` charting call
    Returns:
        A `pandas.DataFrame` with a column "px_fit_results" containing the `statsmodels`
        results objects, along with columns identifying the subset of the data the
        trendline was fit on.
    )_px_trendlines)figs    rV   get_trendline_resultsrg   p   s     rX   Mapping)show_in_trace_namegrouperval_mapsequenceupdatervariablefacet	TraceSpecconstructorattrstrace_patchmarginalc                 D    	 | d         |         S # t           $ r |cY S w xY w)NrP   )	Exception)argscolumns     rV   	get_labelrz      s:    H~f%%   s    c                     d | d                                          D             }	 ||         S # t          $ r |cY S w xY w)zInvert mapping.
    Find key corresponding to value column in dict args["labels"].
    Returns `column` if the value does not exist.
    c                     i | ]\  }}||	S r_   r_   ).0keyvalues      rV   
<dictcomp>z invert_label.<locals>.<dictcomp>   s    MMMlsEucMMMrX   rP   )itemsrw   )rx   ry   reversed_labelss      rV   invert_labelr      s\    
 NMd8n6J6J6L6LMMMOv&&   s   . ==dfcol_namereturnc                     t           j                            |                                 x}          r||         j        j        dv S |                     |          j                                        S )Nifc)nwdependenciesis_pandas_like_dataframe	to_nativedtypekind
get_column
is_numeric)r   r   	df_natives      rV   _is_continuousr      s`    	//R\\^^0K	LL 7 "(-66==""(33555rX   sc                    | j         }|t          j        k    r| j                            d          dz  S |t          j        k    r|j        dv r| j                            d          dz  S |j        dk    r| j                            d          dz  S |j        dk    r| j                            d          dz  S d}t          |          d	| }t          |          )
Nms  )r   r   usi@B nsi ʚ;z%Unexpected dtype, please report a bugzExpected Date or Datetime, got )	r   r   Datedt	timestampDatetime	time_unit
ValueError	TypeError)r   r   msgs      rV   _to_unix_epoch_secondsr      s    GEt~~d##e++?k))4>>$''%//_$$4>>$'')33_$$4>>$''-779CS//!777nnrX   c                     d}	 t          j        | |          fd|D             vrS |dz  }|dk    rd| d| d	}t          |          L)
zWraps of Narwhals generate_temporary_column_name to generate a token
    which is guaranteed to not be in columns, nor in [col + token for col in columns]
    r   T)columnsc                     h | ]}|  	S r_   r_   )r}   r   rb   s     rV   	<setcomp>z2_generate_temporary_column_name.<locals>.<setcomp>   s!    8881Au888rX   r   d   zKInternal Error: Plotly was not able to generate a column name with n_bytes=z and not in zo.
Please report this to https://github.com/plotly/plotly.py/issues/new and we will try to replicate and fix it.)r   generate_temporary_column_nameAssertionError)n_bytesr   counterr   rb   s       @rV   _generate_temporary_column_namer      s     G&1'7KKK 888888888L1S==(( ()0( ( (  !%%%#&rX   c                    t          | |          x}}d| v r|dk    s,|dk    rd| v r| d         dk    s|dk    rd| v r| d         dk    r| d         pd}|dk    r|d	|}nd}d
| v rl| d
         d|dk    r	| d
         }nU| d
         }|dk    r$|dk    rdd	|}n9|dk    r|d	|}n+|d|}n#|dk    rdd|}n|dk    rdd|}n|d	|}d| v r| d         |d| d         d}|S )Nhistfuncr   r   orientationhr   vcountz of histnormsumprobabilityfractionpercentz weighted by z of sum of barnormz (normalized as ))rz   )rx   ry   roleoriginal_labellabelr   r   s          rV   get_decorated_labelr      s   &tV444NUT	CKKMT11d=6IS6P6PCKKMT11d=6IS6P6P
#.ww"*((EE2EEE$z"2">Z(
+u$$=00.8jj%% @!Y...6hh >7?xx P..1;UUCEE**1:EEBEE*2((EE:Ei!</4uud9oooFELrX   c                 8   dk    sdk    rt          d|          i dgd d           S dk    sdk    rGdk    rd	nd
}t          d||          i d t          dd          D             d dk    rdnd          S                     d          ^}}dk    rd}dk    rd}d}dv rd}d}| |dz            dk    rt                      }n| |dz                                            }t          d| |         || |dz            fdd           S )Nr:   r7   F c                     |S rR   r_   tracer   s     rV   <lambda>zmake_mapping.<locals>.<lambda>      a rX   )ri   rj   rk   rl   rn   rm   ro   r8   r9   r   r   c                     g | ]}|S r_   r_   )r}   is     rV   
<listcomp>z make_mapping.<locals>.<listcomp>  s    000Aa000rX   r   r   c                     |S rR   r_   r   s     rV   r   zmake_mapping.<locals>.<lambda>  r   rX   rowcol)ri   rn   rj   rk   rl   rm   ro   .r;   color_discretedashr=   )patternshaper>   _mapidentityT	_sequencec                 d    |                      d                    gz             |ii          S )Nr   )updatejoin)r   r   other_variablesparentrn   s     rV   r   zmake_mapping.<locals>.<lambda>'  s5    chhzO;<<a@A"
 "
 rX   )rh   rangesplitr   copy)rx   rn   lettervprefixarg_namerk   r   r   s    `    @@rV   make_mappingr      s   <8/@#@#@$NT''
 
 
 	
 ;(k"9"9 K//S$N00q$000''#{22%%
 
 
 	
 ,4>>#+>+>(VXGH7"6'''"!Gf++--w'(--//Xg+,
 
 
 
 
 
 
 
 
 
rX   c                 Z   $%  d         %d v r3 d         r+t          j                            d          gd          j                                        pi }d}d}j        D ]} |         $t           $|          }	|dk    rf $%fd	j        D             }
 fd
|
D             |d<   j        t          j
        k    r(|d         D ]}t          d          |d<   d|d<   d|d<   $
=|dk    rOd|vrt                      |d<                       $          |d         d<   d|d         d<   ||d         d<   d||	<   |dk    rj        t          j        k    rd|d<   |dk    rj        t          j        k    rd|d<   $|dk    r d         rx d         rot                              t          j         d          d                                                                       dk    r                     d         d          }|                     d                   }|                     d                   }|j        t           j        k    s|j        t           j        k    rt-          |          }ng|j                                        sN	 |                    t          j                              }n&# t4          $ r t5          d d         z            w xY w|j                                        sE	 |                    t          j                              }n# t4          $ r t5          d           w xY w|                                |                                z   }|                    |                               d                   |d<   |d         j        t           j        k    rH|d         j        j        6|d         j                            d                                           |d<   n|d                                          |d<   tB          $         } | d!         |                     d                   |                                 |                                  d          d         |                                           \  }}}t          |          t          |d                   k    s
J d"            ||d<   d|tE            d                   <   d#|tE            d                   <   |#                    d$          rL|dd%         }|$                    d&          rd'nd(}||vri ||<                       $          ||         |<   |d)k    r?t          $          d*k    r*                    t          j        $                    |d+<   T|d,k    rLj        t          j        t          j%        t          j&        fvr                     $          |d-<   |dk    rd.}|d/k    rwj        t          j        t          j%        t          j&        fvrJtO          $t                    } (                    d)          pg }$D ]}|r	$|         s| (                    d           (                    d           (                    d0           (                    d1          fv rb	  d)         )                    |          }nA# t4          tT          tV          f$ r' t          |          }|,                    |           Y nw xY wt           |d          }d2|z  ||<   t          |          d*k    r/ j        d3 t          -                    |          D              |d+<   $|d4k    r j        t          j.        t          j/        t          j0        fv r$                    $          |d0<   d5|d6<   d7||	<   yj        t          j1        t          j2        t          j3        t          j4        t          j5        fv r&d|vrt                      |d<    (                    d8          r0                    $          |d         d9<   d5|d         d6<   d:||	<   g |d         d9<    d;          d;                                         }ni }                    $          6                                D ]r}|(                    |          4 d<         t          |          t           d<                   z           ||<   |d         d9         ,                    ||                    sd}j        t          j7        t          j8        fv rd=}||vrt                      ||<                       $          ||         d4<   d5||         d6<   d>|z  ||	<   	K|d?k    r                    $          |d@<   	k|dAk    r                    $          ||<   dB||	<   	|dCk    r)                    $          ||<   |	dCk    rdDn|	}dE||<   	|dFk    r)                    $          ||<   |	dFk    rdGn|	}dH||<   	|d@k    r)                    $          ||<   |	d@k    rdIn|	}dJ||<   
|dKk    rj        t          j1        t          j2        t          j3        t          j4        t          j5        fv r)                    $          |dL<   |	dKk    rdMn|	}dN||<   
                    $          ||<   
                    $          ||<   dO|z  ||	<   
ȉj        t          j        k    r|dPv s%j        t          j%        t          j&        fv r|d0k    r
|	dO|z  ||	<   j        t          j8        t          j7        fvrts          |          } d/         rtO           d/         t                    r|:                                D ]|\  }}tw           |          } |  d/         v r] d/         |          d*         }!|!r2tO          |!tx                    r|=                    dQdR|!z            ||<   g|>                    |          }"}dS |:                                D             }#|dT?                    |#          z   |dU<   |dUxx         dVz  cc<   ||fS )Wa:  Populates a dict with arguments to update trace

    Parameters
    ----------
    args : dict
        args to be used for the trace
    trace_spec : NamedTuple
        which kind of trace to be used (has constructor, marginal etc.
        attributes)
    trace_data : pandas DataFrame
        data
    mapping_labels : dict
        to be used for hovertemplate
    sizeref : float
        marker sizeref

    Returns
    -------
    trace_patch : dict
        dict to be used to update trace
    fit_results : dict
        fit information to be used for trendlines
    
data_frame
line_closer   verticalhowNr   r2   c                 P   g | ]}r|v rj         t          j        k    st          |          ruj         t          j        k    sI|v sCt          j                            |                                                    d         k    |                    |          fS )Ndimensions_max_cardinality)	rr   go	Parcoordsr   Parcatsr   to_py_scalarr   n_unique)r}   namerx   
attr_valuer   
trace_data
trace_specs     rV   r   z%make_trace_kwargs.<locals>.<listcomp>S  s       # *.););+r|;;~bRV?W?W;*bj88".4:3E3Er}}T':':'C'C'E'EFF89: : z,,T223: : :rX   c                 T    g | ]$\  }}t          t          |          |           %S ))r   r$   )dictrz   )r}   r   ry   rx   s      rV   r   z%make_trace_kwargs.<locals>.<listcomp>_  sD     ) ) )"T6 9T400@@@) ) )rX   T)matchesaxisz%{x}z%{xaxis.title.text}z%{y}z%{yaxis.title.text}r   markerareasizemodesizerefz%{marker.size}
marginal_xr   
marginal_y	trendliner   r   by
nulls_lastzCould not convert value of 'x' ('%s') into a numeric type. If 'x' contains stringified dates, please convert to a datetime column.z3Could not convert value of 'y' into a numeric type.trendline_optionsz/missing-data-handling failure in trendline codez%{y} <b>(trend)</b>error   minus
arrayminusarrayr3   r   
customdatar!   	hovertextz<b>%{hovertext}</b><br><br>r4   r   r   z%%{customdata[%d]}c                 6    g | ]}t          j        |          S r_   r   r   )r}   r   s     rV   r   z%make_trace_kwargs.<locals>.<listcomp>  s     PPPAbfQiiPPPrX   r;   
coloraxis1	coloraxisz%{z}color_is_continuouscolorsz%{color}rF   rE   linez%%{%s.color}r1   r'   r0   z%{location}r$   r   z%{value}r%   r   z	%{parent}idz%{id}r#   rP   r   z%{label}z%%{%s}r   r   }z%s}c                 $    g | ]\  }}|d z   |z   S )=r_   )r}   kr   s      rV   r   z%make_trace_kwargs.<locals>.<listcomp>`  s$    KKKtq!q3w{KKKrX   z<br>hovertemplatez<extra></extra>)@r   concatheadrt   r   rs   r   r   rr   r   Splomr   r   	Histogramlenselectr   
drop_nullssortr   r   r   r   r   castFloat64r   is_nullfilter	time_zoner   replace_time_zoneto_numpytrendline_functionsrz   
startswithendswithHistogram2dHistogram2dContour
isinstancegetindexAttributeErrorKeyErrorappendfromkeys
ChoroplethChoroplethmapChoroplethmapboxSunburstTreemapIciclePie
Funnelareato_listr   r   r   r   r   strreplacepopr   )&rx   r   r   mapping_labelsr   rt   fit_resultshover_header	attr_name
attr_labeldimsdsorted_trace_datar   r   non_missingtrendline_functiony_outerror_xyarrhover_is_dictcustomdata_colsr   positionattr_label_colmappingcat	colorable_labelmapping_labels_copyr  r   k_args	formatter_hover_linesr   r   s&   ```                                 @@rV   make_trace_kwargsrT  .  s   2 L)Bt\ 2Y
JOOA,>,>?ZPPP
(--//52KKL% AB AB	)_
(z9EE
$$       &.  D) ) ) )&*) ) )K% %11$\2 3 3A $T 2 2 2AfII8>458>45#F"";..,0FFK)0:0E0Ej0Q0QH%f-4:H%j13:H%i0-=z**l**)R\99.4N7+l**)R\99.4N7+k))IDWS	DW "))"&cDI*F*FGGRRTT    )349QU(V(V%)44T#Y??A)44T#Y??Aw"+--BG1C1C2155W//11  !rz|| 4 4AA)   ",!j"&s)!,# #  7--//  !rz|| 4 4AA)   ", U# #  %&IIKK!))++$=">K'8'?'?'L'L'W'WS	( (K$ $C(."+==',2<H (,/AA$GGPPRR $C(( ,7s+;+D+D+F+FC()<Z)H&7I7I01)44T#Y??



S	S	#,,..8 84E< u::[-=)>)>>>>I ?>> (-K$AGN9T49#=#=>AVN9T49#=#=>%%g.. LB$RaR=&/&8&8&A&ANllw;..,.K)-7-B-B:-N-NH%c**m++z??Q&& 1;0A0A"&BTBT0U0UK-l**)LN)2  
 0:/D/DZ/P/PK,#r))'Dl**)LN)2  
 %/z4$@$@M&*hh}&=&=&CO)  ( %C %$ HHSMM HHSMM HHSMM HHV,,	#   %8'+M':'@'@'E'EHH *NHE 8 8 8'*?';';H+223777778 *=T3)M)M9M$:~66 ?++a// 5FJ4EPP1O1OPPP5L1 g%%)M$'.  
 (2'<'<Z'H'HK$/;K,17N:..+KJIFM0    {2204H-xx 566 Q:D:O:O&; ;H-h7 >JH-k:5?z22:<H-h7 45A&*+?&@&E&E&G&GGG&(G#-#8#8#D#D#L#L#N#N 
Q 
QC  '{{3//7/34M/N$'LL3t<U7V3W3W$W0" (1(;BB73<PPPP
Q !)I!-"*bl1KKK$*	 3315I.6@6K6KJ6W6WK	*73:FK	*;71?)1KN:..///%/%:%::%F%FE""k)))3)>)>z)J)JI&-:z**h&&)3)>)>z)J)JI&$.($:$:
)3v&&i'')3)>)>z)J)JI&%/9%<%<*)4v&&e##)3)>)>z)J)JI&!+u!4!4*)0v&&g%%)KJIFM.   -7,A,A*,M,MK)(2g(=(=WW:F-7N6**-7-B-B:-N-NK	**)3)>)>z)J)JI&-5	-Az**$44j9P9P"r~r7L&MMMS   %-5	-Az*blBJ%??? *.99 
	7*T,-?"F"F 
	7&,,.. 	7 	71%dA..T,/// $\ 26 :1 =I  7%i55 W56YYsEIDU5V5V/2/33A66KK/B/H/H/J/JKKK'3fkk+6N6N'NO$O$$$(99$$$##s*   '&K#K1&L55M[00;\.-\.c                    t           j        t          t           j        t          t           j        t          t           j        t          t           j        t          t           j	        t          t           j        t          t           j        t          t           j        t          t           j        t          t           j        t          t           j        t$          t           j        t$          i}t(          D ]}t*          ||<   ||v r ||         | ||           d S d S rR   )r   	Scatter3dconfigure_3d_axesScatterternaryconfigure_ternary_axesScatterpolarconfigure_polar_axesScatterpolarglBarpolar
Scattermapconfigure_mapr/  
DensitymapScattermapboxconfigure_mapboxr0  Densitymapbox
Scattergeoconfigure_geor.  
cartesiansconfigure_cartesian_axes)rx   rr   rf   ordersconfiguratorsr   s         rV   configure_axesrj  f  s    
'
1
-
/
)
}
-
}
*
-
*
}
}M  4 43am##"k"4f55555 $#rX   c                    d|z   }d|z   }|| v r/| |         r'd|d<   || v r| |         rd | |         D             |d<   n|| v r| |         r| |         |d<   | |         |v r_d|d<   t          |t          j        j                  r|| |                  n't	          t          || |                                      |d	<   d S d S )
Nlog_range_logtypec                 8    g | ]}t          j        |d           S 
   mathrn  )r}   r   s     rV   r   z+set_cartesian_axis_opts.<locals>.<listcomp>  s"    FFFTXa__FFFrX   r   r  categoryordercategoryarray)r'  r   layoutXAxislistreversed)rx   r   r   rh  log_key	range_keys         rV   set_cartesian_axis_optsr}  |  s    voG6!I$4=ViFFd9oFFFDM	d		tI	YWF|v '_ $	006F4<  hvd6l34455 	_ rX   c                 X   t          |j                  }t          |j        d                   }|                    d          D ]}t          | |d|           |                    d          D ]}t          | |d|           | d         r|                    ddd	d |
           | d         j        j        j        !|                    | d         dk    |           | d         j        j	        j        |
                    d|           | d         r|
                    ddd	d |           | d         j        j	        j        !|
                    | d         dk    |           | d         j        j        j        |                    d|           t          | | d         d          }| d         r|                    |dd           n.t          d|dz             D ]}|                    ||d           t          | | d         d          }	| d         r|
                    |	dd           n.t          d|dz             D ]}
|
                    |	d|
           d| v r| d         r|
                    d           d| v r| d         r|                    d           dt          |dz             z   }| d         r/t          d|dz   d          D ]}|                    |d |           | d         r/t          d|dz   d          D ]}
|
                    dd |
           d S d S )Nr   r   r   r   r   r   r   Fr   )showticklabelsshowlineticksr   r   rB   	histogram)showgridr   Tr   )r  r  r  r   r   )r  r   )
title_textr   r   log_xrn  ro  log_y   )r   ro  r   x2)r   ro  r   )r  	_grid_refselect_yaxesr}  select_xaxesupdate_yaxesrw  yaxisr  xaxisupdate_xaxesr   r   r7  )rx   rf   rh  nrowsncolsr  r  y_titler   x_titler   	matches_ys               rV   !configure_cartesian_marginal_axesr    s   Ea !!E !!a!(( : :eS&9999 !!a!(( : :eS&9999 L 7 5$E 	 	
 	
 	
 
"(19d<&8K&GUSSS
"(19d666L 7 5$E 	 	
 	
 	
 
"(19d<&8K&GUSSS
"(19d666 "$S	377GL AG::::EAI&& 	A 	ACSa@@@@!$S	377GL AG::::EAI&& 	A 	ACQC@@@@ $4=e$$$ $4=e$$$ c%!)nn$IL DEAIq)) 	D 	DCYTsCCCCL ?EAIq)) 	? 	?CT#>>>>? ?	? 	?rX   c                     d| v r| d         sd| v r| d         rt          | ||           d S t          | | d         d          }|                    d          D ]*}|                    |           t	          | |d|           +t          | | d         d          }|                    d          D ].}d	| vr|                    |           t	          | |d|           /d
| v r| d
         r|                    d           d| v r| d         r|                    d           d	| v r|                    d           d| v r<| d         dk    r|                    d           d S |                    d           d S d S )Nr   r   r   r   r  r  r   r  is_timeliner  rn  r  r  dateecdfmoder   r   tozero)	rangemode)r  r   r  r   r}  r  r  r  )rx   rf   rh  r  r  r  r  s          rV   rg  rg    s   l!3l!3)$V<<< "$S	377G!!a!(( : :(((eS&9999 "$S	377G!!a!(( : :$$LLGL,,,eS&9999 $4=e$$$ $4=e$$$f%%%T#%%x00000x00000	 rX   c                    |                     t          t          | | d                             t          t          | | d                             t          t          | | d                                        d S )Nr   r  r   r   )aaxisbaxiscaxis)update_ternariesr   rz   rx   rf   rh  s      rV   rY  rY    s}    id3i88999id3i88999id3i88999      rX   c                    t          t          | d         | d                   t                                }dD ]1\  }}| |         |v r"d||         d<   || |                  ||         d<   2|d	         }| d
         r#d|d<   | d         rd | d         D             |d<   n| d         r| d         |d<   | d         r| d         |d<   |                    |           d S )N	directionstart_angle)r  rotation)angularaxis
radialaxis))r   r  )r   r  r  ru  rv  r  log_rrn  ro  range_rc                 8    g | ]}t          j        |d           S rq  rs  r}   r   s     rV   r   z(configure_polar_axes.<locals>.<listcomp>  s"    "L"L"Lq48Ar??"L"L"LrX   r   range_thetasector)r   update_polars)rx   rf   rh  patchvarr   r  s          rV   r[  r[    s   4#4tM?RSSS66  E
 E = =	T9+2E$K(+1$s)+<E$K(|$JG} 2"
6	? 	M"L"LDO"L"L"LJw	? 	2"&y/JwM .}-herX   c                    t          t          t          | | d                             t          t          | | d                             t          t          | | d                                       }dD ]z}||dz            }| d|z            r)d	|d
<   | d|z            rd | d|z            D             |d<   n| d|z            r| d|z            |d<   | |         |v rd|d<   || |                  |d<   {|                    |           d S )Nr   r  r   r   )r  r  zaxis)r   r   r   r   rl  rn  ro  rm  c                 8    g | ]}t          j        |d           S rq  rs  r  s     rV   r   z%configure_3d_axes.<locals>.<listcomp>#  s"     R R RQ!R R R RrX   r   r  ru  rv  )r   rz   update_scenes)rx   rf   rh  r  r   r   s         rV   rW  rW    sD   id3i88999id3i88999id3i88999  E " 9 9Vf_%  	8 DLHv%& S R R$x&?P:Q R R RWHv%& 8 $X%6 7W<6!!$+D!$*4<$8D!erX   c                 0   | d         }|sad| v r]d| v rYt          | d         | d                                                  | d         | d                                                            }|                    t          || d         | d                    d S )	Ncenterr.   r/   r   r.   r/   zoommapbox_style)accesstokenr  r  style)r   meanupdate_mapboxesra   rx   rf   rh  r  s       rV   rb  rb  -  s    (^F 
etmm\"4;/4466\"4;/4466
 
 
  &\>"	      rX   c                 $   | d         }|sad| v r]d| v rYt          | d         | d                                                  | d         | d                                                            }|                    || d         | d                    d S )	Nr  r.   r/   r   r  r  	map_style)r  r  r  )r   r  update_mapsr  s       rV   r_  r_  <  s    (^F 
etmm\"4;/4466\"4;/4466
 
 
 OO&\;      rX   c           
          |                     | d         | d         | d         | d         t          | d                              d S )Nr  scope	fitboundsbasemap_visible
projectionr  )r  r  r  visibler  )update_geosr   r  s      rV   re  re  J  sY    OOH~7m{#&'T,/000      rX   c           
      f   fdd| v r| d         rt          |j                  dk    rd  d          gdddd g d          gd	ddgd
dddddddddd	g|j        _        ddd
dt	          | | d                   dz   iddddddfd|j        D             d	g|j        _        d S d S d S d S )Nc                 :    | t           j        k    ddd| dddS )N)durationredraw	immediateTlinear)r  easing)framemodefromcurrent
transition)r   Scatter)r  rr   s    rV   
frame_argsz0configure_animation_controls.<locals>.frame_argsU  s5    "*kRZ6OPP'/8DD	
 
 	
rX   r7   r   i  z&#9654;animaterx   r   methodr   z&#9724;leftrr  F   )r   tFbuttonsg?righttop)	r  r  pad
showactivero  r   xanchorr   yanchorprefixr  <   )r   r  g?c                 H    g | ]}|j         g d           g|j         ddS )r   r  r  r   )r}   fr  s     rV   r   z0configure_animation_controls.<locals>.<listcomp>  sN        	 #$&::a== 9!""+   rX   )	activer  r  currentvaluer  r  r   r   steps)r  framesrw  updatemenusrz   sliders)rx   rr   rf   r  s    ` @rV   configure_animation_controlsr  T  se   
 
 
 
 
 D  T*;%< SZSTATAT
 "&zz# 7!*"+  #'A 7!*"+  $b))#!" ) "

4  !id3D.EFFL!  b))    !Z   

3 !   ATATrX   c                 X   |t           j        t           j        fv rd| v r| d         dk    sF| d         dk    rjt          | d                   dk    rQ|                     d          dk    r8| d         0|t           j        k    rt           j        }d	|v r|d	= nt           j        }t          |||d           g}d
D ]}d|z   | v r| d|z            rd }t          |dk    rdnd|dk    rdnd          }| d|z            dk    r0t          t           j	        |d|z   gt          d-d|d||          }n| d|z            dk    r/t          t           j
        |ddgt          |          |          }n| d|z            dk    r/t          t           j        |ddgt          d          |          }nQ| d|z            dk    rBdd d
}t          t           j        |ddgt          d!d"d!id#d$d%d&||         i'          |          }d"|v sd"| vr=d(|j        vrt                      |j        d(<   | d)         d$         }	|	|j        d(         d"<   |                    |           |                     d*          r=|                     d+d,          d,k    r#|                    t          | |                     |S ).Nrender_modewebglautor   r   
line_shapespliner7   r   r  	marginal_r   x1r  r   y1y2)r  r  r        ?)opacitybingrouprq   violinr!   r4   )
scalegroupboxT)notchedrugzline-ns-openzline-ew-openzrgba(255,255,255,0)r;   allr   pointsr<   )	fillcolorr  	boxpointsjitterhoveronr   r   rG   r   trendline_scoper   r_   )r   r  rZ  r  r(  	Scatterglr\  rp   r   r  ViolinBoxrt   r,  make_trendline_spec)
rx   rr   rs   rt   resultr   r   axis_mapsymbolsfirst_default_colors
             rV   make_trace_specr    s[   rz2?333D  7**]#v--\*++d22HH\**h66*+3 bj(( l K//#M2 /UK>>?F  0& 0&4''Dv1E,F'J$mmdd$mmdd  H K&()[88& "!;#78 $ NS6 N NX N N#	  

 kF*+x77& "	!<> $ 7 7 7#	  

 kF*+u44& "!<> $T 2 2 2#	  

 kF*+u44 .^DD& "!<> $"7%'<="'  ( ('&/:! ! ! $  
 %7$#6#6:#9997;vvJ*84&*+C&DQ&G#<O
&x09MM*%%% xx >*;W!E!E!P!P)$<<===MrX   c                     t          |t          j        k    rt          j        nt          j        dgt	          d          d           }| d         rt	          | d                   |j        d<   |S )Nr   lines)r  rq   trendline_color_overrider;   r  )rp   r   r  r  r   rt   )rx   rr   r   s      rV   r  r    s~     bl** LLmg&&&	 	 	J &' V)-D9S4T)U)U)U
v&rX   c                     dS )Nr   r_   r   s    rV   	one_groupr    s    2rX   c                    t           j        D ]&}|| v r | |         t          t           |          | |<   '| d         +t          j        j        t          j        j        | d<   nd| d<   	 t          j        | d                  | d<   n8# t          $ r+ t          j        	                    | d                   | d<   Y nw xY wd| v rZ| d         ;| d         j        j
        j        r$d | d         j        j
        j        D             | d<   | d         t          j        | d<   d| v r| d         X|V|dk    rd}n |            j        }t          | d         j        |d           x}r d |D             }t          |          r|| d<   | d         '| d         j        j        r| d         j        j        | d<   | d         t"          j        | d<   d	| v r]| d	         1| d         j        j        rd
 | d         j        j        D             | d	<   | d	         rt          | d	                   sg d| d	<   d| v r]| d         1| d         j        j        rd | d         j        j        D             | d<   | d         rt          | d                   sg d| d<   d| v r_| d         1| d         j        j        rd | d         j        j        D             | d<   | d         rt          | d                   sg d| d<   d S d S d S )NrB   plotlyrG   c                     g | ]
}|d          S )r   r_   r  s     rV   r   z)apply_default_cascade.<locals>.<listcomp>  s)     . . .!. . .rX   rE   timelinebarc                 p    g | ]3}t          |d           t          |j        d          '|j        j        4S )r   r;   )hasattrr   r;   )r}   r   s     rV   r   z)apply_default_cascade.<locals>.<listcomp>  sU     ) ) )"z844)  
 17;;	)%+) ) )rX   rH   c                 &    g | ]}|j         j        S r_   )r   r<   r}   scatters     rV   r   z)apply_default_cascade.<locals>.<listcomp>/  s*     ' ' '*1%' ' 'rX   )circlediamondsquarer   crossrJ   c                 &    g | ]}|j         j        S r_   )r  r   r$  s     rV   r   z)apply_default_cascade.<locals>.<listcomp>7  s*     * * *&-!* * *rX   )soliddotr   longdashdashdotlongdashdotrL   c                 0    g | ]}|j         j        j        S r_   )r   r   r   )r}   r   s     rV   r   z)apply_default_cascade.<locals>.<listcomp>F  s-     . . .-0
"(. . .rX   )r   /\r   +r   )defaultsr^   getattrpio	templatesdefaultrw   r   rw  Template
colorscaler   Viridisro  dataanycolorwayr   D3r%  r   )rx   rr   param
trace_typetrace_data_listtrace_specific_colorss         rV   apply_default_cascaderD    s    # 3 3D==T%[0!(E22DK J= ,"}4D'D@=j)9:Z @ @ @9--d:.>??Z@  4'')*2Z '2= 3. .":.5@K. . .D)* ()1-7-?D)*
 !D(()*2{7Nj(("

([]]/
")$z*:*?T"R"RR 	L) )&5) ) )% ,-- L6KD23)*2tJ7G7N7W2.2:.>.E.ND*+)*2.9nD*+ D  !"*tJ/?/D/L*' '59*5E5J5R' ' 'D"# %& 	Tc$7H2I.J.J 	T&S&S&SD"#t##$%-$z2B2G2O-* *15j1A1F1N* * *D%& () 	T:N5O1P1P 	* * *D%&  4''()1d:6F6K6O1. .484D4I4M. . .D)* ,- 	LS)*6
 6
 	L .L-K-KD)*** ('
	L 	Ls   (B 2B98B9c                 :    | |vr| S t          d| d| d          )Nz.A name conflict was encountered for argument 'z '. A column or index with name 'z' is ambiguous.)	NameError)
field_namereserved_namess     rV   _check_name_not_reservedrI  O  s:    ''i@J

JJJX
 
 	
rX   c                 v   | d         }t                      }| D ]}|t          vr|t          v r| |         n| |         g}|*|D ]}|t          |t                    r|                    |           0t          j                            |          rkt          j	        |d          }|j
        }|rK||j        v rB||                    |          k                                    }|r|                    |           |t          j        |          u r!|j
        |                    |j
                    |S )z
    This function builds a list of columns of the data_frame argument used
    as arguments, either as str/int arguments or given as columns
    (pandas series type).
    r   NTseries_only)setall_attrablesarray_attrablesr'  r7  addr   r   is_into_seriesfrom_nativer   r   r   r  maybe_get_index)	rx   r   rH  fieldr#   arg
arg_seriesr   in_dfs	            rV   _get_reserved_col_namesrX  Y  s`    L)BUUN - -%%$77Ud5k]= 	- 	-C{C%% 
-""3''''//44 -^CTBBB
%? 5BJ 6 6'2==+B+BBGGIIE 5&**8444*2....383G""38,,,	- rX   c                    |*t          |t                    st          |t                    rdS |rt          ||j                  rdS 	 t	          |           n# t
          $ r Y dS w xY w|D ]X}t          |t                    st          |t                    r
| || vr dS 6	 t	          |           G# t
          $ r Y  dS w xY wdS )zReturns True if arg looks like it's a list of columns or references to columns
    in df_input, and False otherwise (in which case it's assumed to be a single column
    or reference to a column).
    NFT)r'  r7  int
MultiIndexiterr   )r   rU  
is_pd_likenative_namespacer   s        rV   _is_col_listr_  y  s   
 {jc**{jc.B.B{u j&6&ABB uS				   uu  a 	As!3!3 	!7"2"2uu #3Q   uuu4s$   	A 
A'&A'#B33
CCc                     t          | t                    s?t          | t                    rt          |           dk    st          | t                    s| dS dS )zReturns True if x is an iterable which can be transformed into a pandas Series,
    False for the other types of possible values of a `hover_data` dict.
    A tuple of length 2 is a special case corresponding to a (format, data) tuple.
    r  NFT)r'  r7  tupler  boolr  s    rV   _isinstance_listlikerc    sX     	1cq%  %(VVq[[a &19utrX   c                 8    | |S || v s||v rd|z   }|| v 	||v |S )NrR  r_   )r   r   extras      rV   _escape_col_namerf    sF    
g

U!2!2> g

U!2!2OrX   c                 6   t          j        | dd          } t          | t           j                  r|                     |          S |t          j        || |          S 	 ddl}t          j        || |          S # t          $ r d}t          |          w xY w)zVAssuming x is list-like or even an existing Series, returns a new Series named `name`.TrL  pass_throughNr   r$   r^  r   <Pandas installation is required if no dataframe is provided.)	r   rR  r'  Seriesrename
new_seriespandasImportErrorNotImplementedError)r   r   r^  pdr   s        rV   to_named_seriesrs    s     	qd>>>A!RY +xx~~		%}$qCSTTTT	+=d1rJJJJ 	+ 	+ 	+PC%c***	+s   !A< <Bc                    | d         du}i }i g }t                      }	|rt          |           nt                      }
d| v r,| d         $|st          d          fdj        D             }d| v o"| d         ot	          | d         t
                    }|r| d         D ]}t          | d         |                   rd| d         |         f| d         |<   t	          | d         |         t                    s| d         |         df| d         |<   |r*| d         |         d         |v rt          d	|z            t          D ]Pt          vr| 
                              gn| 
                              }|:t          vrgn'fd
t          t          |                    D             }t          t          ||                    D ]\  }\  }}t          |          r/t          |t          t!          |                                       nd|Ld}|r8t	          |j                  r#t%          d| dj         dj         d          t	          |t(          t*          f          rct-          |j        t1          |j                  n||
          }t	          |t(                    r|j        |<   nO|                    |           n8t	          |t0                    st7          |d          sdk    r|r| d         t1          |                   d         t1          |          }| d         |         d         }rWt          |          x}k    rBt          d||t1          t9          |                                                    fz            t=          ||          ||<   nW|st          d|z            |j        vrN|r|||fv rd|dt1          t9          j                            d|}|dk    r|dz  }t          |          rWt                    x}k    rBt          d||t1          t9          |                                                    fz            t1          |          }t=                              |          |          ||<   n\|rt7          |d          r|rN|tA          j!                  u r8|j"        |j"        j        v rd}n|j"        }tG          j        |||g          }n`|j"        Y|j"        j        v rKt=          ||j"                                      |j"                  k    $                                r|j"        }|t-          ||
          }rWt          |          x}k    rBt          d||t1          t9          |                                                    fz            t=          |t1          |                    |t1          |          <   |
J d            t          vrt1          |          | <   n4t	          |          t
                    rnt1          |          |          |<   dk    r"|	%                    t1          |                     ŐRt          |          r/t          |t          t!          |                                       nd'	 ddl&}|n# tN          $ r d}tQ          |          w xY w|rOddl)}tA          j*        d|+                                         |,                    fd!|D                        |,                    fd"D                        |rtA          j-        |          }nN	 ddl&}n# tN          $ r d#}tQ          |          w xY wtA          j.        |/                    i           d$          }||	fS )%ac  
    After this function runs, the `all_attrables` keys of `args` all contain only
    references to columns of `df_output`. This function handles the extraction of data
    from `args["attrable"]` and column-name-generation as appropriate, and adds the
    data to `df_output` and then replaces `args["attrable"]` with the appropriate
    reference.
    r   Nr2   zjNo data were provided. Please provide data either with the `data_frame` or with the `dimensions` argument.c                 <    i | ]}|                     |          S r_   )r   )r}   r   df_inputs     rV   r   z/process_args_into_dataframe.<locals>.<dictcomp>  s)    SSS3h11#66SSSrX   r4   Tr   zIAmbiguous input: values for '%s' appear both in hover_data and data_framec                 :    g | ]}d z   t          |          z   S )rR  r7  )r}   r   rG  s     rV   r   z/process_args_into_dataframe.<locals>.<listcomp>  s)    OOO*s"SVV+OOOrX   r   z
Argument 'z' is a  MultiIndex. = MultiIndex is not supported by plotly express at the moment.__len__zAll arguments should have the same length. The length of hover_data key `%s` is %d, whereas the length of previously-processed arguments %s is %dzString or int arguments are only possible when a DataFrame or an array is provided in the `data_frame` argument. No DataFrame was provided, but argument '%s' is of type str or int.z
Value of 'z?' is not the name of a column in 'data_frame'. Expected one of z but received: r)  z6
 To use the index, pass it in directly as `df.index`.zAll arguments should have the same length. The length of column argument `df[%s]` is %d, whereas the length of previously-processed arguments %s is %dr   zAll arguments should have the same length. The length of argument `%s` is %d, whereas the length of previously-processed arguments %s is %d)r   r   r^  zData-frame processing failure, likely due to a internal bug. Please report this to https://github.com/plotly/plotly.py/issues/new and we will try to replicate and fix it.r6   rk  __placeholder__rj  c                 <    i | ]}|                     |          S r_   )alias)r}   r   range_seriess     rV   r   z/process_args_into_dataframe.<locals>.<dictcomp>  s)    KKKX|))(33KKKrX   c                 T    i | ]$}|t          j        ||         gz             %S )rj  )r   rn  )r}   r   	constantslengthr^  s     rV   r   z/process_args_into_dataframe.<locals>.<dictcomp>  sT     	
 	
 	
  bm!(+,v5!1  	
 	
 	
rX   z Pandas installation is required.
eager_only)0rM  rX  r   r   r'  r   rc  ra  rN  rO  r(  r   r  	enumeratezipnextr\  r[  r   r[   r   r   rI  r   r7  r   r,  r"  ry  keysrs  r   r   rS  r   rf  r  rP  ro  rp  rq  numpyrn  aranger   	from_dictrR  	DataFrame) rx   	wide_modevar_name
value_namer]  r^  df_provided	df_outputrangeswide_id_varsrH  hover_data_is_dictr  argument_list
field_listr   argumentrT  r   real_argumentreal_lengtherr_msg
actual_lenlen_argrr  r   npr  rv  rG  r  r  s         `                     @@@@@rV   process_args_into_dataframer    s	    %)$6H$&K
 IIF55L6AL,T222suuN t\ 2 : 	T|   TSSS(BRSSSI 	 	1	1tL)400   
l# 		 		A#D$6q$9:: F)-tL/A!/D(E\"1%d<03U;; F)-l);A)>(E\"1% tL1!4Q7CX _  
 $ g0 g0
 00 XXj!!""*%% 	   00 LLOOOOU3};M;M5N5NOOO 	 %.c-.L.L$M$M L	0 L	0 A %>A)nnSS4Y#8#89:::RSFH j3C3NOO - - -/?/H - -'0- - -   (Xu$566 o3+3>+EC'''5"  h11 ,*2.Ih''MM(++++Hc** e'(I2N2N e,..* /\*3x==9!<H  #8}}H$($6x$@$CM #m2D2D#D;"O"O(P !) + #D)9)9$:$: ; ; &	
 
 
 +:%x1A+ +Ih'' % $$6 9>>   X%555  
2X*h1G%G%G 
  %uuc$x/?*@*@&A&A&A&A88M  
 $w..#'``G(111 s8}}!< G G$L "&Y^^%5%5 6 677"	
 
 
  #8}}H*9 ++H55x+ +Ih''
  578V#<#< 5! 5h"2DX2N2N&N&N#=0HMXEU4U4U'.HH'/}H#3$,h:8N$ $
 %M5 (1A A A /$,hm=M!" !" $,#6#6x}#E#E!F "cee !B (0}H#7~NNH #h--7wFBB$L !'3tINN4D4D/E/E+F+FOP   ,;X%5, , ,	#h--( ''( ('' 00#&x==Z  D,d33 4&)(mmZ #_,,  X///YL	0\ 7:)nnKS4Y001222!F	+! 	+ 	+ 	+PC%c***	+  

}"99V$$-
 
 

 	KKKKFKKK	
 	
 	
 	
 	
 	
 	
 	
 	
 &	
 	
 	

 
 
  FL++			+ 	+ 	+ 	+4C%c***	+ N2<<#3#3EEE	l""s    [' '\^ ^3c           	        %& | D ]}|t           v r| |         xt          | |         t                    rt          | |                   | |<   G|dv r(t          | |         t                    r| |         g| |<   st	          | |                   | |<   | d         du}d}d}|rt
          j                            | d                   r0| d         j        %t          j	        | d         d          | d<   d}n3t
          j        
                    | d                   rBt          j	        | d         d                                          | d<   | d         j        %d}nt          t          j	        | d         dd          x}t
          j                  r,|| d<   t          j        |          d	k    }| d         j        %nit          t          j	        | d         dd
          x}t
          j                  r&|                                | d<   | d         j        %nt          | d         d          rAt          j	        | d                                         d          | d<   | d         j        %d}n	 ddl}	 t          j	        |                    | d                             | d<   | d         j        %d}n6# t$          $ r) dt'          | d                    d}	t)          |	          w xY wn8# t*          $ r) dt'          | d                    d}	t)          |	          w xY wd%| d         }
|r|st          j        |
          nd}|r|st          j        |
          nd}|                     d          du }|                     d          du }|rdnt3          %| d         ||          }|rdnt3          %| d         ||          }d}d}d}d}t4          j        t4          j        g}|t4          j        k    pd| v }|t<          v rs|r|rt?          d          |r|r|rd}|r5t          %|j                   r tC          d|j"         d|j"         d          t	          %          | d<   |rt          %|j#                  r%j$        }nd}|dv s|%v rd}|t4          j%        k    r|                     d          pd}n|                     d          pd}|| d<   d| d<   n||k    rd}|r| d         n| d         | d<   |r|r| d         %u r%j$        }|r3t          | d         |j#                  rt	          | d                   | d<   |dv s|r|%v rd}|r|rdnd}n|rdnd}d| |rdnd<   d| d<   |s|s|rdnd }|r"tM          %d!g           }tM          %|g           }|r|r2t          j	        | d         '                                d          | d<   n%fd"| (                                D             }| D ]:}| |         0|t           v r'|)                    %fd#| |         D                        ;t	          |          %t          j	        | d         *                    %          '                                d          | d<   ddl+}|}d}|t4          j,        t4          j-        t4          j%        g|z   v r|s|sp||k    rjd$D ]g}|                     |          P||n t]          tM          %|||g          %          | |<   |t4          j-        k    r|}R| d         |dk    rdnd| d<   h|r~||||k    r| d         	|rdnd| d<   |r?|r=|;t          ||j                   r tC          d&|j"         d|j"         d          || d<   n$t]          tM          %d'||g          %          | d<   d}t          |                     d(          t                    r| d(         t^          k    rd}d| d(<   ta          | |||||          \  }&tM          |j        d)||g          }|s|r|t4          j-        k    ru|dk    rdnd}tc          || |                   s@|| |<   |2                    t          j3        d*          4                    |                    }n| d         |dk    rdnd| d<   ||v r| d= |r&fd+| d         D             } | d= |dk    r	| d         }n|d k    r	| d         }n| d         }| d= d}!| D ][}"|5                    |"          j6        }#|#7                                rd,nt          |#          }#|!|#}!F|!|#k    rt?          d-          \|8                    &| ||.          }ts          |j                  ts          tu          |j                            k    s
J d/            |2                    t          j;        |          <                    t
          j=                            }|dk    }$|r!|| |$rdnd<   || |$rdnd<   | d(         p|| d(<   n&|t4          j,        t4          j%        g|z   v rA|| |$rdnd<   || |$rdnd<   |t4          j        k    r| d(         p|| d(<   d0| v r| d0         p|| d0<   n|t4          j-        k    rtc          ||          r || |$rdnd<   || |$rdnd<   | d(         p|| d(<   n|| |$rdnd<   || |$rdnd<   |2                    t          j3        d*          4                    |                    }| d(         p|| d(<   n.|t4          j>        t4          j?        fv r|p|| |$rdnd<   || |$rdnd<   |r|t4          j,        k    r| d         | d         d1| d2<   n| d         Jd| d2<   d| d<   || d<   |2                    t          j3        d*          4                    |                    }nId| d2<   d| d<   || d<   |2                    t          j3        d*          4                    |                    }|rd| d(<   || d<   | S )3a  
    Constructs a dataframe and modifies `args` in-place.

    The argument values in `args` can be either strings corresponding to
    existing columns of a dataframe, or data arrays (lists, numpy arrays,
    pandas columns, series).

    Parameters
    ----------
    args : OrderedDict
        arguments passed to the px function and subsequently modified
    constructor : graph_object trace class
        the trace type selected for this figure
    N)r3   r4   r   FTr  rK  )eager_or_interchange_onlyri  interchangerh  toPandasr   z%Unable to convert data_frame of type zm to pandas DataFrame. Please provide a supported dataframe type or a type that can be passed to pd.DataFrame.z)Attempting to convert data_frame of type zl to pandas DataFrame, but Pandas is not installed. Convert it to supported dataframe type or install pandas.r   r   r  zPCannot accept list of column references or list of columns for both `x` and `y`.zData frame columns is a ry  rz  r6   )Nr   r)  rn   r   r   r   r&   __x____y__r   c                 F    h | ]}t          |t                    r|v |S r_   )r'  r7  r}   r   r   s     rV   r   z"build_dataframe.<locals>.<setcomp>  s7     ! ! !Jq#,>,>!CD<<<<<rX   c              3   $   K   | ]
}|v |V  d S rR   r_   r  s     rV   	<genexpr>z"build_dataframe.<locals>.<genexpr>  s'      ,T,T1qG||Q||||,T,TrX   r  )r   zData frame index is a r)  r;   r   r   c                     g | ]}|v|	S r_   r_   )r}   r   r  s     rV   r   z#build_dataframe.<locals>.<listcomp>  s#    UUUq?T?T1?T?T?TrX   numberzLPlotly Express cannot process wide-form data with columns of different type.)r)  onvariable_namer  zWide-mode name-inference failure, likely due to a internal bug. Please report this to https://github.com/plotly/plotly.py/issues/new and we will try to replicate and fix it.r:   r   r   )@rO  r'  r   r7  ry  r   r   r   r   rR  is_pandas_like_seriesto_framer  	get_levelrl  r"  r  ro  rw   ro  rq  rp  rS  get_native_namespacer(  r_  r   r%  r&  r  rf  r   r[  r   r[   Indexr   Funnelrf  to_arrowr$   r   r  pyarrowr  Barr   NO_COLORr  r   with_columnslitr~  r   r   r   unpivotr  rM  r   r  Stringr  r  )'rx   rr   rT  r  r]  needs_interchangingr   seriesrr  r   rv  r)  r^  no_xno_ywide_xwide_yr  r  wide_cross_namer  hist2d_typeshist1d_orientationwide_orientationnecessary_columnspamissing_bar_dimaxno_colorr  
count_name	other_dimwide_value_varsr   r   v_dtypeorient_vr   r  s'                                        @@rV   build_dataframer    s   "  	0 	0O##U(?$u+t,, 0"4;//U777JUS= =7  $E{mU"4;//U |$D0K J    P?33D4FGG J	/<(0G!#\0Bt!T!T!TDJJ _2243EFF D	/!#\"" " "hjj  <(0GJJ
 .\"dQU   J L	
 
 :	/ ",D"$,z":":m"K<(0GG
 n\"4   F I	
 
 -	/ "(!2!2D<(0GG T,'44 "	/!#\"++--$" " "D <(0GJJ/####3)+T,%788* *D& #<08G!%JJ  3 3 3HT,EW@X@X H H H  .c2223   / / /PT,EW@X@X P P P 
 *#.../ $($6H 	2	8$$$ 
 	2	)))  88C==D D88C==D D 	L'49j:JKK  	L'49j:JKK  IHOJNB$9:L$4J
d8Jj   	f 	b    '	A4 '	AD '	AI j2B2MNN -/?/H - -'0- - -  
 %)MMD!  j2B2HII  "<333x77J7J%bi''#'88M#:#:#Ac  #'88M#:#:#Ac "2D!%DvI17$FDIIT#YD! (z (d?.Cw.N.N"< Djo)>@P@VWW D(,T/-B(C(C_%333 4 (G 3 3%! :*0#933c  *0#933c +/D'C(!%D A A-3"@'' ;%gw;;
#GXr::
   	!#\"++--$" " "D! ! ! !;;==! ! !  U U;*u/G/G%,,,T,T,T,TU,T,T,TTTT,--G!#\"))'22;;==$" " "D 	O
BFBI6EEE" 	F  	Lddll  L L88B<<' !, ""27B:@V"W"W   H #bf,,*,.69;s##D/ 	0t||] 3 ;-1&:ccs]# z e.?e%5%@AA #81A1J 8 8+48 8 8  
 &+\""%**7Gh
=STT& & &\" H$((7##S)) d7mx.G.GW : I| ")"3Wx>TUUJ M M[BF-B-B
 +c11CCs	ii99 	M$.D!!..rvayyz/J/JKKII M"*-<-C-Ccc]#l"" =8 VUUUd?&;UUU!g%%"3iOO''"3iOO"<0O  	 	A**1--3G")"4"4"6"6HhhCLLG}'!! b   " %%"!	 & 
 
	 9$%%S1B-C-C)D)DDDD$ EDD **26(+;+;+@+@+K+KLL	#s* 	8-7D)c*-<D)c* M5XDMMRZ3lBBB-<D)c*-7D)c*bn,, $W 9Wt##%),%7%C8\"BF""i44 :1@H-SS#.1;H-SS#. $W 9W1;H-SS#.1;H-SS#.%2226!99??:3N3NOO	 $W 9WRY///-<-HD)c*-7D)c* LkRZ779 T#Y%:$D#Y#D"%D"DI!..rvayyz/J/JKKII#D"%D"DI!..rvayyz/J/JKKI W"DKs$   6K2 ;?J; :K2 ;3K..K2 23L%c                 *   | j         }|                     |dd                              t          j                                                                                  t          j                                        t          j                                                            t          j        t          j                                        	                    d          }
                    |          }|                                st          d|j        d                   D ]}|d d |f          |d d |dz
  f         z  }t          j        |                                          rJ|                                                    d          }t%          d                    |                    t          j        dd	gt+                    z  t          j                    t          j                  
           j        di fd|D                                 t          j        |d	d                    	                    d                                          }t3          |                                                                          }t7          t9          |d d         |dd                    d          D ]4\  }	\  }
}||
v r(|	|v r$t%          d                    |	          d          5d S )NFTr   
descendingr   )	null_maskr  r   z*None entries cannot have not-None children
fill_valuer   )r   r$   r   r^  c                     i | ]@}|                     |                                                   |                     AS r_   )r   zip_with)r}   r   	df_sortedfill_seriesr  s     rV   r   z/_check_dataframe_all_leaves.<locals>.<dictcomp>p  sZ     
 
 
 y##A&&//1E1Ea1H1H0H+VV
 
 
rX   )	separatorignore_nulls)row_stringsr  )startz4Non-leaves rows are not permitted in the dataframe 
zis not a leaf.r_   )r   r  r  r   r  r  r  r  any_horizontalr   r  is_emptyr   r   r   r=  r6  r)  r   r   rn  r  r  r  
concat_strrM  arg_truer  r  )r   colsnull_indices_masknull_mask_filteredcol_idx#null_entries_with_non_null_childrenrow_idxr  null_indicesr   current_rownext_rowr  r  r  s               @@@rV   _check_dataframe_all_leavesr  Q  s/   :D4EdCCI  !1!1!3!344I  ry{{!;!;<<I!((#BFHH-- )  j  #))*;<<&&(( Q 2 8 ;<< 	 	G $AAAwJ//2DQQQRS^2TT 0 BFFHHII =EEGGMMdSS @MM'**   -tc)nn$ikk0;;	  K '	&  
 
 
 
 
 

 
 
 I 	dbuMMM 	 	
 	
 
M	"	"	  (1133;;==>>L&/Kk!""o..a' ' '  ""K ##!|*;*;Ga     	 rX   c                 Z   | d         }| d         ddd         t          |ddd                             | d         rt          || d                    nd}|                                }d D             }|                    d t	          |          D                       }|i | d	         r	 |                    t          j        | d	                                       t          j                                        }n&# t          $ r t          d
| d	         z            w xY w| d         rb| d         | d	         k    rP| d	         dz   }|                    t          j        | d	                                       |                    }|| d	<   | d	         n|                                                                }d|vrdnd                    d |D                       |                    t          j        d                                                  }| d	<   t          j                  <   g }g }t#          d|                                                                          | d         r|r|                    | d                    t          j        | d                                                   | d         <   t          j        | d                                                                       | d                     | d           <   n>|                    | d                    t          j        | d                   | d         <   t+          t-          |                                                                                                                  }|                    fd|D                       }|D ]}	|	vr|                    |	           t          j        |	                                          |	<   t          j        |	                                                              |	            |	  <   t+          t-          |          t-          g d          z
            }g }
| d         r]|s[|                    t          j        | d                   t          j                  z                      | d                             }dt
          j        dt
          j        ffd}t3                    D ]\  }} |                    |d         d          j        d-i                     |||          } |j        |t          j        |                              t          j                              t          j        d          t          j        |                              t          j                              d}|t=                    dz
  k     rt#          dg |ddd          }|                    t          j        fdtA          t=                    dz
  |d          D             d                              |                                        t          j        t          j        |          t          j        d          gd          t          j        t          j        |          t          j        d          gd                    !                    |          }|                    t          j        d          j"        #                    d d          j"        #                    d!d          "          }|
                     |j$        dddg|            t          j%        t          j&        |
d#$          '                                          }| d         r|rd%}||j(        v r|d&z  }||j(        v |                    t          j        | d                                       t          j                                                  |                    )                    |d'          }|| d<   d| d<   d| d(<   d| d)<   d| d*<   | d         r| d+         s| d         g| d+<   notU          | d+         tV                    r3| d+         ,                    | d                   sd,| d+         | d         <   n!| d+                             | d                    | S ).z^
    Build dataframe for sunburst, treemap, or icicle when the path argument is provided.
    r   r5   Nr  r;   Fc                     g | ]}|d z   S )
_path_copyr_   )r}   r   s     rV   r   z/process_dataframe_hierarchy.<locals>.<listcomp>  s    ===H<'===rX   c              3   j   K   | ].\  }}t          j        |                              |          V  /d S rR   )r   r   r~  )r}   new_col_namer   s      rV   r  z.process_dataframe_hierarchy.<locals>.<genexpr>  sR        "L( 	x|,,     rX   r$   zDColumn `%s` of `df` could not be converted to a numerical data type._sumr   r   c                 ,    g | ]}t          |          S r_   rx  )r}   els     rV   r   z/process_dataframe_hierarchy.<locals>.<listcomp>  s    ;V;V;VCGG;V;V;VrX   r      )r   r   c              3      K   | ]@}|vt          j        |                              t          j                              V  Ad S rR   r   r   r  r  )r}   r   agg_fs     rV   r  z.process_dataframe_hierarchy.<locals>.<genexpr>  sA      UUaunn	44nnnnUUrX   )rP   r   r  dframer   c                      | j         g fd|D             fd|D             R                      fd|D                       S )z
        - continuous_aggs is either [] or [args["color"]]
        - discrete_aggs is either [args["color"], <rest_of_cols>] or [<rest_of cols>]
        c                 b    g | ]+}t          j        |          t          j                  z  ,S r_   r  )r}   r   count_colnames     rV   r   zAprocess_dataframe_hierarchy.<locals>.post_agg.<locals>.<listcomp>
  s0    MMMcbfSkkBF=111MMMrX   c                 &   g | ]}t          j        t          j        |            d k                                  t          j        |                                        t          j        d                                        |          S )r   z(?))r   whenr   then	otherwiser  r~  r}   r   n_unique_tokens     rV   r   zAprocess_dataframe_hierarchy.<locals>.post_agg.<locals>.<listcomp>  s         GBFc#;>#;#;<<ABBT"&++&&Yrve}}--U3ZZ  rX   c                     g | ]}|  	S r_   r_   r   s     rV   r   zAprocess_dataframe_hierarchy.<locals>.post_agg.<locals>.<listcomp>  s$    BBBS3(((BBBrX   )r  drop)r  continuous_aggsdiscrete_aggsr  r  s      rV   post_aggz-process_dataframe_hierarchy.<locals>.post_agg  s    
 #v" 
MMMM_MMM
    )  
 
 
 $BBBBMBBB
C
C	DrX   Tdrop_null_keysrP   r   r  c                     g | ]@}t          j        |                                       t          j                              AS r_   r  )r}   jr5   s     rV   r   z/process_dataframe_hierarchy.<locals>.<listcomp>+  sI        ! F47OO00==  rX   r1  )r  )r   r  z/?$z^/?)r   r   r   sort_color_if_discrete_color0r   r'   r#   r%   r4   )TNr_   )-r  r   lazyr  r  r   r   r  r  rw   r   r~  collect_schemar#   r   r  r   r   r,  maxr   ry  rM  
difference	LazyFramer  group_byaggpiper  r  r  r   r  r7  r8  r  maybe_reset_indexr  collectr   r  r'  r   r(  )rx   r   discrete_colornew_pathnew_value_col_namer   r  r  r  r   	all_treesr  r   leveldfgdf_tree_concat_str_tokendf_all_treessort_col_namer  r  r  r5   s                      @@@@rV   process_dataframe_hierarchyr!    sY	    L)B<"D4":///>B7mVDM::::QVN	B=====H	  &)(D&9&9   
 
B DEH~ '	X!7!7!<!<RZ\\!J!JKKBB 	 	 	Vx.!  	 = 	0T']d8n<<!%h&!8X!7!7!=!=>P!Q!QRRB/DNX ##%%++--g--GG277;V;Vg;V;V;V3W3W 	 __RVAYY__];;<<&X 6-00E-MO4B--//5577  N@ G} 9 	9  g///#%6$w-#8#8#<#<#>#>E$w- tG}%%$w-999:: T']4N4455 ""4=111#%6$w-#8#8E$w-  B%%''--//00;;DAABBD	UUUUdUUU	U	UB  e  %%%**E#Js$$&&,,-E^-E-EFF S*.**+ D		C : : :;;;<<DIG} 
^ 
__VDM""RVM%:%::AA$w-PP
 
D D", D D D D D D D$ dOO ,M ,M5BKKQRRK66  T(O];; 	 ##"6%==%%bikk226"::ve}}!!")++..	
 
 
 s4yy1} ?$Ed$EH$Eh$E$E! ! ! $$M   %*3t99q=!R%@%@   #&   e-..  = 122BF84D4DEQT   } 122BF4LLAS  	    '((% , &&6(##'//r::>FFubQQ ' 
 
 	(Hd)JT)JKLLLL'	)(L(L(L(T(T(V(VWWL G} 2 26|333S M |333#00F4=!!&&ry{{3399-HH
 

$-D$
1
1 	
 &DDLDKDMDOG} 5L! 	5"&w-D\*D11 	5%))$w-88 A4@\"4=1%%d7m444Ks   7AD	 	#D,c                    d| d<   | d         | d         t          d          | d         }|j        fd| d         | d         fD             }|rb	 |                    t          j        |          j                                                  }n"# t          $ r}t          d	          |d}~ww xY w|                    t          j        | d                   t          j        | d                   z
  j	        
                                                    | d                             | d<   | d         | d
<   | d         | d<   | d= | d= | S )z8
    Massage input for bar traces for px.timeline()
    Tr  r   Nr    z#Both x_start and x_end are requiredr   c                 l    g | ]0}|         t           j        k    |         t           j        k    .|1S r_   )r   r   r   )r}   r   schemas     rV   r   z.process_dataframe_timeline.<locals>.<listcomp>j  sD       #;"+%%&+*@*@ 	*@*@*@rX   zCBoth x_start and x_end must refer to data convertible to datetimes.r   r   )r   r$  r  r   r   r7  to_datetimerw   r   r   total_millisecondsr~  )rx   r   to_convert_to_datetimeexcr$  s       @rV   process_dataframe_timeliner)  `  sw    DI$w-"7>???L)BYF   OT']3    	(>!?!?!C!O!O!Q!QRRBB 	 	 	U 	 	W		Y!8!8	8	  	tG}		 D
 WDI	?DLYgKs   >B 
B2B--B2c           
      &   dd l }|                     d          }|| |fS | d                             |i                                           }|s| |fS | d         }d|d<   d|d<   |                    |                              d	
                                          fdt          j        t          |          z             D             }t          j
        d|j                  }|                    t          j        |                              ||                    t!          |                    t          j                                      |                                        |                              |          | d<   | |fS )Nr   r#   rO   r   Fr  	clockwiser  Tmaintain_orderc                     g | ]}|v |	S r_   r_   )r}   r   uniquess     rV   r   z)process_dataframe_pie.<locals>.<listcomp>  s    WWW1!w,,Q,,,rX      )return_dtype)r  r(  r   r   uniquer6  r   r-  ry  r   r   r   r  r   replace_strictr  r  UInt32r~  r  r  )	rx   rt   r  r#   order_inr   orderrb   r/  s	           @rV   process_dataframe_pier7    sx   HHWE}[  %&**5"55::<<H ![  L)BK*KmmE"")))>>FFHHGWWWW,T(^^g-EFFWWWE -a<<E
F5MM^E299SZZ#8#8ry^QQU5\\	
 	

 
e	e 	 rX   c                 X     fdt           t          z   D             }g } d         }d}d v rS d         rKt          j        |                     d                                                              d         dz  z  }d v rd v rd	 vr|                    d           n4 d         r1t          | d                   r|                    d           d
 d<   n|t          j	        t          j
        t          j        fv r|                    d           d d<   n|                    d           nd v s|t          j        k    r|                    d           n{|t          j        t          j        fv rL|                    d            d         r. d         g  d<    d                              d                    n|                    d           t          d|v o[ d         oS|t          j        t          j        fvo9|t          j
        t          j	        t          j        fvp                     d                    }nd}d v r|                    d           d v r|                    d           d v r:|t          j        fv r|                    d           n|                    d           d v rʉ d         d u}	 d         d u}
 d         ]|t          j        t          j        fv r
|
r|	sd d<   n9|t          j        t          j        t          j        t          j        fv r	|	r|
sd d<    d         B|	r@|
r>t          | d                   }t          | d                   }|r|sd d<   |r|sd d<    d         d d<   |t          j        k    rM|	r|
r d         
dx d<   |d<    d         } d         }|dk    r|nd |d <   |dk    rd n||d!<   |dk    rdnd|d"<    d         |d<   |t          j        t          j        fv rx|t          j        k    rd#nd$}||         O d         G d          d         k    r d         dk    rd%||<   n# d          d         k    r d         dk    rd%||<   ||         d&||<   |t          j        k    r d'          d         
dx d<   |d<                        d(d          durm|t          j        t          j        fv rd'}n#|t          j        k    r d         dk    rdnd}nd)} d(         d
u rd*|z   d+z   |d,<   nd*|z   d-z    d(         z   d+z   |d,<   |t          j        t          j        t          j        fv rd
}d.|d/<   d0 v r d0         $d1 v r d1         d%k    rt5          d23          |d4<   n`|t          j        t          j        t          j        t          j        t          j        fv r d0         |d0<   nt5           d0         3          |d4<   d v sd v rt7                      }                     d5d
          r|                    d5                                d6          s*                     d          s                     d7          r|                    d7                                d6          r|                    d6           t;          |          dk    r|                    d5           d8                    t?          |                    |d9<   n@|t          j         k    r0d v s|t          j!        t          j"        fv rd7 d6         rd:nd;z   |d9<   d< v rt5           d<         =          |d><   n%d? v r!t5           d?         d@k    rdAndB=          |d><   dC v r9 dD         |dD<   tG           dC         dE          s dC         n dC         j$        |dC<   dF v r0 d         dk    rdGndH} d         dk    rdGndH} dF          |<   d  |<   |%                                r
d x dI<    dJ<                        dJ                               dH          d  dH<                        dI                               dG          d  dG<                        dG          *                     dH                               dI          d dK<   dL v rI dL         A dL         tL          vr2tO          dM dL         dNtL          (                                          dO v r dO         t5                       dO<   dP v r>                     dPd           dQvrtO          dRdS dP         z  z              dP          dT<   |)                     fdUtT          D                         fdV|D             }tW           |||          }||||fS )WNc                     g | ]}|v |	S r_   r_   r}   r  rx   s     rV   r   z infer_config.<locals>.<listcomp>  s    HHH1a4iiQiiirX   r   r   r   rN   r  r;   rG   rE   Tr	  Fzmarker.colorr:   z
line.colorr4   r=   z	line.dashr<   zmarker.symbolr>   zfillpattern.shapezmarker.pattern.shaper   r   r   r   r   r   r   nbinsnbinsxnbinsyr  boxmode
violinmodeoverlaygroupr   	text_autor   z%{r  texttemplate:r  r  r  barmoder  )r  r   r  r"   markersr3  r  z+textr   r  )r   r  r  rz  vhhvgeojsonfeatureidkey__geo_interface__ru   r   r   r8   r9   facet_col_wrapr   zValue 'z!' for `trendline` must be one of r   ecdfnorm)Nr   r   z<`ecdfnorm` must be one of None, 'percent' or 'probability'. z'%s' was provided.r   c                     g | ]}|v |	S r_   r_   r:  s     rV   r   z infer_config.<locals>.<listcomp>|	  s    BBBT		!			rX   c                 0    g | ]}t          |          S r_   )r   )r}   r   rx   s     rV   r   z infer_config.<locals>.<listcomp>	  s#    EEE!T1--EEErX   ),direct_attrablesrO  r   r   r   r  r,  r   r   r1  r2  r3  r&  r4  r5  rb  r(  r  r  r  r  r  r  r%  r`  rc  r   rM  rP  r  r   sortedr  r^  ra  r"  rK  r  r"  r   r  extendgroup_attrablesr  )rx   rr   rt   layout_patchrs   grouped_attrsr   r   show_colorbarhas_xhas_yx_is_continuousy_is_continuousr   r;  r  r   modesrI  other_positiongrouped_mappingstrace_specss   `                     rV   infer_configr_    s[   HHHH(?:HHHEML)B G~~$v,~OBMM$v,77;;==>>jAQUVAVV 	
 $#t++(44W%%%%= 9^BW%F%F 9LL)))26D.// R["*bi$HHHLL)))27D.//!((8888T!![B4I%I%I  ....RVR]333LL!!!G} 9%-)+D&\"))$w-888  000u WBFBM#:: BJRY#GG 388122
 
 d[)))4_---$2:,&&  !45555  !7888S	%S	%&r|RZ888 . .*-D'BFBFBI FFF . .*-D'&5&U&,Rc;;O,Rc;;O * *&)]# * *&)]#&"%D",&& C C4
#3#;=BBZ ;z#:}-KME-8C-?-?EETK!,73,>,>DDEK!-8C-?-?ccSK
#%)-%8M"29bf--- +rv 5 599<DD!)d7m.G9W--$}2E2L2L)2L&&#Y$w-//D4G34N4N)2L&D!)%,T" 	r~%%I!$5::Z;z2xxU##5002>2+@AAAFFBF"" /366SSCFFF$$*.-#*=K''*.-#*=[@Q*QTW*WK'r~r}b6FGGG#/K D	?"D  T)_	%A%A(,S(9(9(9H%MFIM
 
 
 &*)_K	""$(i$A$A$AK!t 3 388GT"" 	IIg88F 	!txx11 	!TXXi5H5H 	!IIi   88F 	IIfu::??IIg!hhve}}55F		 	 DKBM2;K+LLL'd6l+J77KFt"l);<<<F	t		"z*j88$$d
 
 
F D&*>&:N# 4	?,?@@3DOOi2 	I T#'#6##=#=<<<)-m)<)C)Cj)X#^ 
{{}} 5044[D- xx(TXXl-C-C-O!\xx(TXXl-C-C-O!\ 	*88L!!-88K  ,!"dtK0<$777*$$$&9&>&>&@&@&@B  
 d""t,?'@'H$(FF !T88J%%-MMMN&j)99:    
+Z BBBB_BBBCCC FEEE}EEE "$UKHHK('=@@rX   c           	         d| vri n| d                                          | d         }g }t                      }t                    D ]\  }}|t          k    r|                    d           &||vr>|                    |                              d                                          ||<   ||         }t          |          dk    r|                    |d                    |vr||<   t          t          j        t          |                   |z                       |<   t          |          t                    k    rt          |          |i}nfdD             t          |                    d	                                                    t                                          fd
          }	fd|	D             }
fdt#          |
|	          D             }|fS )a  
    `orders` is the user-supplied ordering with the remaining data-frame-supplied
    ordering appended if the column is used for grouping. It includes anything the user
    gave, for any variable, including values not present in the dataset. It's a dict
    where the keys are e.g. "x" or "color"

    `groups` is the dicts of groups, ordered by the order above. Its keys are
    tuples like [("value1", ""), ("value2", "")] where each tuple contains the name
    of a single dimension-group
    rO   r   r   Tr,  r   r   c                     g | ]}|v |	S r_   r_   )r}   rA  rj   s     rV   r   z)get_groups_and_orders.<locals>.<listcomp>	  s#    JJJe'9I9IE9I9I9IrX   r  c                 <    fdt          |           D             S )Nc                 d    g | ],\  }}||         v r|                              |          nd -S )r  r)  )r}   rA  r   rh  s      rV   r   z;get_groups_and_orders.<locals>.<lambda>.<locals>.<listcomp>	  sR           E5 /4ve}.D.Du##E***"     rX   )r  )r$   rh  required_groupers    rV   r   z'get_groups_and_orders.<locals>.<lambda>	  s6            $'(8&$A$A      rX   r~   c                 J    g | ]t          fd D                       S )c                 `    g | ]*}|t           k    rd n                    |                   +S )r   )r  r)  )r}   r   re  sub_group_namess     rV   r   z4get_groups_and_orders.<locals>.<listcomp>.<listcomp>	  sQ         )++ ,-=-C-CC-H-HI	  rX   )ra  )r}   ri  rj   re  s    @rV   r   z)get_groups_and_orders.<locals>.<listcomp>	  sc     #
 #
 #
         '  	 	#
 #
 #
rX   c                 (    i | ]\  }}||         S r_   r_   )r}   sfr   groupeds      rV   r   z)get_groups_and_orders.<locals>.<dictcomp>	  s0     
 
 
$r1B

 
 
rX   )r   r   r  r  r,  r   r2  r6  r  ry  r   r-  ra  r  __iter__rQ  r  r  )rx   rj   r   single_group_nameunique_cacher   r   r/  groupssorted_group_namesfull_sorted_group_namesrl  rh  re  s    `         @@@rV   get_groups_and_ordersrs  	  s\    %D00RRd;L6M6R6R6T6TFL)B66LG$$ V V3)$$R((((,&&MM#&&--T-BBJJLL S! #3'G7||q  !((444&  %s";#7VC[8I8IG8S#T#TUUs
W--)**B/JJJJvJJJr{{#3D{IIRRTTUU#LLNN    
 
 
#
 #
 #
 #
 #
 $6#
 #
 #

 
 
 
(+,CEW(X(X
 
 
 6>rX   c                    78 |pi }|pi }t           |           t           |           |t          j        t          j        t          j        fv r d         t                      |t          j        fv rt           |          \   }|dk    rt          j	        }t                      d                     d                               d          fv rd|d<   t           |||          \  }}}}d	 |D             pt          g}t           |          \  }	7g }
g }d
x}}|D ]}|j        7vr|j        d         |j        d<   !7|j                 }|j        dk    r6t'            d                   dz   88fd|D             }
t)          |
          }|j        dk    r6t'            d                   dz   88fd|D             }t)          |          }|D ]G}||j        vr<|j        t)          |j                  t)          |j                  z           |j        |<   Ht+           |            j                  }i }t/                      }g }d }                     dd          }|	                                D ]\  }}t/                      }t/                      }d}t3          |||          D ]s\  }}}|t          k    rbt'           |          }t5          |j        t6                    s+t9          |          ||<   |j        rt9          |          ||<   |j        dk    r|}td                    |                                           }||vrtC                      ||<   ||         }|D ](}|"                    |          } |j"        t          j#        t          j$        t          j%        t          j&        t          j'        t          j(        t          j)        t          j*        t          j        t          j        t          j        fvr| +                    ||dk    o||v           |                    d          }!|j"        t          j	        t          j,        t          j-        t          j.        fv r|!dk    s|!| +                    d|           |/                    |           d
| _0        d
| _1        te          |          D ]\  }"}||"         }	 |3                    | |j        |                    n.# th          $ r  ||d         k    r(|j"        t          j-        t          j,        fv r	|j        dv s|j"        t          j.        fv r
|j        dv rn||d         k    rO|j"        t          j.        fv r;|j        dk    r0| +                    tk          |j        |                               np|j"        t          j%        t          j&        t          j'        fv rE|j        dk    r:| +                    d
gt)          |          z  |j        |         gd!z  d"d#           n Y nw xY w|j        dk    r|j        |         }#n%                     d          |j6        d$k    rd!}#nd
}#|j        dk    r&|j        |         }|rd
|d
z
  |z  z   }#d
|d
z
  |z  z   }n|j6        d%k    rd!}nd
}|#d
k    r|#| _0        |d
k    r|| _1        |d         j"        t          j7        k    rO|j"        t          j,        k    r:| j8        j9        r.| +                    tk          | j8        j9                              d& v r d'         d(k    r d$         n d%         }$ d'         d)k    r d$         n d%         }%                     d&d*          d+k    }&|:                    |$|& d,          }|;                    |%          <                                }'|=                    t}          j?        |%          @                                A                    |%                    }|&s|:                    |$d"d,          }                     d&d*          d-k    r=|=                    |'t}          j?        |%          z
  A                    |%                    } d.         d/k    r+|=                    t}          j?        |%          |'z            }n9 d.         d0k    r-|=                    t}          j?        |%          |'z  d1z            }t           |||C                                |          \  }(})| +                    |(           |)2|D                    |C                                           |)|d2         d3<   ||vrtk          g |4          ||<   ||         d5         D                    |            *d6 |                                 D             }*t)          |*          d
k    rt          |* 7fd78          }*|r|t          j*        t          j(        t          j)        fv rd9nd}+ d:         pd d g},t          d;d<          }-tk          |-G                     d=                    d>         |,d         |,d
         tk          t            |+         |+          ?          @          |dA<   dBD ]}. |.         r |.         ||.<   tk          dC          |dD<   |rd                    |          |dD         dE<    dF         r dF         |dE<   n dG         jI        jJ        jK        dHdIi|dJ<    dK         r dK         |dL<   dM v r* dM         r" dG         jI        jL        jM        dN|dD         dO<   |r't          jO        ||z            }t          ||          }                     d          |d
z  }                     d          |d
z  }t           ||*|||
|          }/|*D ]U}0|0d5         D ]J} t5          | t          jR                  rt          | |/jI        |/jT        || j0        z
  d
z   | j1                   KV|/U                    t)          |*          dk    r|*d         d5         ng            |/V                    |           dG v r% dG         |/V                     dG         dP           |*D ]}1t9          |1dQ                   |1dQ<   t)          |          d
k    r|*ng |/_W                             dR          r.                     dSdT          dUk    rt           |          }2|2"                    dVdVd"W          }3dX|2jY        vr\|D ]Y}|j        dk    rL|j        t)          |j                  t)          |j                  z           }4tk          |4          |2jY        dX<   Zt           |2 dY         i |          \  }(})|3+                    |(           |/Z                    |3dZdZd[           |/[                    d2d\           |)#|D                    tk          |)]                     |r?	 dd l\}5|5]                    |          |/_^        n&# t          $ r d^}6t          |6          w xY wg |/_^        t           ||/7           t           ||/           |/S )_N)rr   r5   r  r  r   r   r@  rE  c                 *    g | ]}|j         pt          S r_   )rj   r  r  s     rV   r   zmake_figure.<locals>.<listcomp>	  s    @@@!qy%I@@@rX   r   r   r   r   r9   r  c                 4    g | ]}t          |          z   S r_   rx  r}   r   r  s     rV   r   zmake_figure.<locals>.<listcomp>	  #    EEE!fs1vvoEEErX   r   r8   c                 4    g | ]}t          |          z   S r_   rx  rw  s     rV   r   zmake_figure.<locals>.<listcomp>	  rx  rX   rL  r7   z, r  )legendgroup
showlegendrA  T)alignmentgroupoffsetgroup)r<   r   r   )r<   r   r;   r  )r   r  F)r   r:  	showscaler{  r   r   r  r   r   r   standardrz  r  complementaryrM  r   r   g      Y@r  px_fit_results)r<  r   r<  c                     g | ]}|S r_   r_   )r}   r  s     rV   r   zmake_figure.<locals>.<listcomp>
  s    ---!---rX   c                 R    d                                       | d                   S )Nr7   r   rd  )r  rx   rh  s    rV   r   zmake_figure.<locals>.<lambda>
  s$    fT2C-D&E&K&KAfI&V&V rX   rf  r   range_colorr:  make_figurerG   color_continuous_midpointr  )r:  cmidcmincmaxcolorbarr  )rD   rC   )tracegroupgaplegendr  titlerB   r  r  marginsubtitletitle_subtitle_textr   constant
itemsizing)rB   	overwriter   r   r  r   overallzOverall Trendline)r   rz  r{  r  r   r  )r   r   exclude_empty_subplots)selectorr{  )r  z*Trendlines require pandas to be installed.)crD  r  r   r2  r1  r3  r!  r4  r7  r  r)  r(  r_  r  rs  rj   rl   rk   ro   rz   r  r   ro  r   r   r  r'  r   r7  ri   rn   r   r$   rM  rr   r   r   r.  r/  r0  r`  rc  r%  r   r  r  r  rP  _subplot_row_subplot_colr  rm   r   r   ru   r&  r  r;   r  r   r   r  r   r   cum_sumr~  rT  r   r,  rQ  r   validate_coercer   rw  r  r  r  r  rt  ceilmininit_figurer  r   r  
add_tracesupdate_layoutr  r  rt   	add_traceupdate_tracesro  r  re   rp  rq  rj  r  )9rx   rr   rt   rT  r^  r]  r   rV  rj   rp  
col_labels
row_labelsr  r  msorted_valuesvalsubplot_typetrace_names_by_framer  trendline_rowstrace_name_labelsrL  
group_namerA  r:  
frame_namer   r~   
trace_nametrace_namesr   r   rE  r   r   r   r  	ascending	group_sumr  r;  
frame_listcolorvarr  colorscale_validatorr   rf   r  r  trendline_spectrendline_trace
next_colorrr  r   rh  r  s9   `                                                      @@rV   r  r  	  s   #K%2L$K88884--Drz2;	:::tF|?W*400rvh1$DDkj  f)$// txx--txx/E/EFFF"+Y<Hk;= =9K!7M A@/?@@@OYKG*499NFFJJEE R R9F""JqMAIbMM"19-Mw%"4k):;;cAEEEE}EEE
Jw%"4k):;;cAEEEE}EEE
J$ R Rai''%&ZAIQZ0P%QAIcNR 00BCCL]]FNXX.22N#\\^^ Z5 Z5
E$'MM
w
4DEE 	% 	%KCaic**!!)[99 :*-c((N3'+ :14S)#.:!222!$JYY07799::
111/2uu ,*:6% H	5 H	5J**
*;;E%
 # 
	.    * *b 0 RZ{5R     #&&y11G%"&"&")R\)RRR7""goDjIIIOOJ''' "#E!"E!"233 B- B-1 m"IIeQYs^4444!       #k!n44&2ry"&6III !
.K K K '2r|nDD !
.@ @ @ "k!n44&2r|nDDJ'11Dqy~,F,F,FGGGG".M2+;R=PQR RJ'11 cCJJ.()	#'7!';&+'+	 %     A F 7e##)C.CC ..:&/366 7e##)C.C% ?C!G#>?C!G~#=>!*c1177),E&77),E&A*b.CCC*bf44J$ 5 Duz/?$@$@$@AAAT!!$($73$>$>tCyyDI#'#6##=#=d3ii49 HHZ<<
J	

d9}QU
VV!,, #%%  **26#;;+>+>+@+@+F+Fs+K+KLL  S!JJ$5TJRRE88J
33FF!..	BF3KK0G/N/Ns/S/STTE
#}44!..rvc{{Y/FGGEE*%22!..si0G5/PQQE!2j%)<)<)>)>" "E; LL&%%n&9&9&;&;<<<7Br"#34''%)r
%C%C%Cz":v&--e4444QH	5R .-V]]__---J
:VVVVV
 
 

  
 r~r}b>NOOO C 	
 =)9dD\2<OO%)+;;-.  12QQ.tT(^XNN  
&
 
&
 
&
\" ! & &7 	&"1gLO!222L L/3yy9J/K/KX|,G} +%)']\""	j		 	'	)	1"%rXJ ?.2:.>*+$L 	#*5=/9X|, +	%.011E>**xx)
xx)

lJuj* C
   6] 	 	E%** %
**Q."   	 NNC
OOa,?,?:a=((RHHHl###Td:.:4
#3tDDD # #&	NN&		"6{{QBCJxx D*;W!E!E!R!R,T;??(44$2ERW 5 
 
 333% P P:((!"C	NNS__,L!MJ9=J9O9O9ON.v6..$|"4b'
 
{ 	u%%%E$ 	 	
 	
 	
 	2$777"!!$k"B"B"BCCC 	 	+!#n!=!=C 	+ 	+ 	+>C%c***	+  4c6222 {C888Js   !S00D(X	X	x" "x>c                    fdt          |          D             }dgz  }dg|z  }	|                     dd          }
dk    r|                     d          0| d         dk    sd| v r| d         rd	}nd
}|g|dz
  z  d|z
  gz   }	d}n1|
r|                     d          pd}n|                     d          pd}|                     d          0| d         dk    sd| v r| d         rd	}nd
}|gdz
  z  d|z
  gz   }d}n`|                     d          pd}nH|
r|                     d          pd}n|                     d          pd}|                     d          pd}|
rd g|z  z  }t          |          |z  k     r+|                    d            t          |          |z  k     +t          |          D ]1}t                    D ]}||dz
  |z
  z  |z            ||z  |z   <    2d }	 t	          ||dd|
rg nt          t          |                    |
rg n||
r|ng |||	|d          }n-# t          $ r } ||dd            ||dd            d }~ww xY w|j        j	        D ]}|
                    d            |S )Nc                 <    g | ]}t          pd           gz  S )domainr  )r   )r}   rR  r  r  s     rV   r   zinit_figure.<locals>.<listcomp>  s1    QQQqd01112U:QQQrX   g      ?rL  r   xyr   r  r;   gGz?gzG?r   g{Gz?facet_row_spacinggQ?gQ?r   g{Gzt?facet_col_spacingg{Gz?c                     |d| j         d         v r,| j         d         d                    |          z   f| _         | dS )z
        Translates the spacing errors thrown by the underlying make_subplots
        routine into one that describes an argument adjustable through px.
        z spacingr   z5
Use the {facet_arg} argument to adjust this spacing.)	facet_argN)rx   format)er  r  s      rV   _spacing_error_translatorz.init_figure.<locals>._spacing_error_translatorG  sW    
 &II'AF1I55q	88>8S8STAF
 G 65rX   r  zbottom-left)rowsr  specsshared_xaxesshared_yaxes
row_titlescolumn_titlessubplot_titleshorizontal_spacingvertical_spacingrow_heightscolumn_widths
start_cell
HorizontalVertical)font)r   r(  r  r,  r   ry  rz  r   rw  annotationsr   )rx   r  r  r  r  r  r  r  r  r  rL  	main_sizer  r  subplot_labelsr   r
  r  rf   r  annots    `  `                rV   r  r    s   QQQQQE%LLQQQE EEMM%%-KXX.22N t88L!!-L![00W__g_ 		 	$+3q9}oEK# 	E#xx(;<<D#xx(;<<D88L!!-L![00W__g_ 		 	&K5195YGM!&!%*=!>!>!F$  	E#xx(;<<D#xx(;<<D!XX&9::Bd X%%/*oo--d### *oo--u 	X 	XA5\\ X X0:EAIMU;RUV;V0Wq5y1}--X  +Krrhz6J6J1K1K .>""J-;C>>1-#'$
 
 
    !!!\3FGGG!!!Z1DEEE '    $Js   3AH6 6
I  II )NN)eplotly.graph_objs
graph_objsr   	plotly.ioior6  collectionsr   r   _special_inputsr   r   r   r"  r	   r
   r   r   r   _plotly_utils.basevalidatorsr   plotly.colorsr   r   rt  plotly._subplotsr   r   r   narwhals.stable.v1stablev1r   r  r   rP  rO  rS  renameable_group_attrablesrN  r  r  r  r  r  r  rf  r  r%  r&  objectr@   r4  ra   rc   rg   rh   rp   rz   r   r  r7  rb  r   rl  r   r   r   r   rT  rj  r}  r  rg  rY  r[  rW  rb  r_  re  r  r  r  r  rD  rI  rX  r_  rc  rf  rs  r  r  r  r!  r)  r7  r_  rs  r  r  r_   rX   rV   <module>r     s|               / / / / / / / / 9 9 9 9 9 9 9 9 9 9 E E E E E E E E E E E E E E < < < < < < 1 1 1 1 1 1 1 1                     " d7yc    UTTHHHIPPPQ FEEF  WVVMMM    &8;UU  j",	2629M
 
r|R^R-BC C
% % % % % % % %P :<<      *    J{$W$W$WXX	  	 	 	6r| 6s 6t 6 6 6 6bi BI    && & & & &2# # #L/ / /du$ u$ u$p	6 6 6,
 
 
&>? >? >?B#1 #1 #1L    2  ,      7
 7
 7
tJ J JZ     ]L ]L ]L@
 
 
  @  2     + + + +&H# H# H#VF F FR7BL 7T 7 7 7 7tR R Rj! ! !H  :bA bA bAJB B BJC C C CL
] ] ] ] ]rX   