
    A>i%                    ~   S r SSKJr  SSKJrJrJrJrJr  SSK	r	SSK
r
SSKrSSKJrJrJr  SSKrSSKrSSKJr  SSKJr  SSKJr  SS	KJrJr  SS
KJrJrJrJ r J!r!  SSK"J#s  J$r%  SSK&J'r'  SSK(J)r)J*r*  SSK+J,r,  \(       a  SSK-J.r.J/r/J0r0J1r1J2r2  SSKJ3r3   " S S5      r4 " S S\45      r5 " S S5      r6 " S S5      r7g)zC
Utilities for conversion to writer-agnostic Excel representation.
    )annotations)CallableHashableIterableMappingSequenceN)TYPE_CHECKINGAnycast)is_list_like)find_stack_level)missing)is_float	is_scalar)	DataFrameIndex
MultiIndexPeriodPeriodIndex)CSS4_COLORS)CSSResolver
CSSWarning)get_level_lengths)ExcelWriterMergeCellsFilePath
IndexLabelStorageOptionsWriteExcelBufferExcelWriterc                  B    \ rS rSrSr\r   S         SS jjrSrg)	ExcelCell?   rowcolvalstyle
mergestartmergeendNc                L    Xl         X l        X0l        X@l        XPl        X`l        g Nr$   )selfr%   r&   r'   r(   r)   r*   s          V/var/www/html/land-tabula/venv/lib/python3.13/site-packages/pandas/io/formats/excel.py__init__ExcelCell.__init__C   s"     
$     )r&   r*   r)   r%   r(   r'   )NNN)
r%   intr&   r2   r)   
int | Noner*   r3   returnNone)__name__
__module____qualname____firstlineno__
__fields__	__slots__r/   __static_attributes__ r1   r.   r"   r"   ?   sQ    IJI !%#!! ! ! ! 
! !r1   r"   c                  L   ^  \ rS rSr                SU 4S jjrSrU =r$ )CssExcelCellT   c	                   > U(       aQ  U(       aJ  XVU4    V
Vs0 s H  u  pU
R                  5       U_M     nn
n[        UR                  5       5      nU" U5      n[        TU ]  " SXWUS.U	D6  g s  snn
f )Nr%   r&   r'   r(   r=   )lower	frozensetitemssuperr/   )r-   r%   r&   r'   r(   
css_stylescss_rowcss_colcss_converterkwargspropdeclaration_dictunique_declarations	__class__s                r.   r/   CssExcelCell.__init__U   s~     - 4>w>N3O 3Oid

c!3O    #,,<,B,B,D"E!"56EJSs%J6J s   A/r=   )r%   r2   r&   r2   r(   dict | NonerG   z3dict[tuple[int, int], list[tuple[str, Any]]] | NonerH   r2   rI   r2   rJ   Callable | Noner4   r5   )r6   r7   r8   r9   r/   r<   __classcell__)rO   s   @r.   r?   r?   T   sf    KK K
 K HK K K 'K 
K Kr1   r?   c                     \ rS rSr% Sr\rSSSSSSS.rSSSSSSSSSSSSSS	.rSSSS
.r	SSSSS.r
S V Vs0 s H  nUR                  5       U_M     snn rS\S'   S/S0S jjr\" 5       r    S1S jr    S1S jrS2S jrS3S jrS4S jrS5S jr    S6S jr        S7S jrS8S jrS9S jrS:S jrS;S  jrS<S! jr    S=S" jrS5S# jrS5S$ jr S>S% jr!S5S& jr"S>S' jr#S?S( jr$S@S) jr%SAS* jr&SBS+ jr'SCS, jr(SBS- jr)S.r*gs  snn f )DCSSToExcelConverterm   a  
A callable for converting CSS declarations to ExcelWriter styles

Supports parts of CSS 2.2, with minimal CSS 3.0 support (e.g. text-shadow),
focusing on font styling, backgrounds, borders and alignment.

Operates by first computing CSS styles in a fairly generic
way (see :meth:`compute_css`) then determining Excel style
properties from CSS properties (see :meth:`build_xlstyle`).

Parameters
----------
inherited : str, optional
    CSS declarations understood to be the containing scope for the
    CSS processed by :meth:`__call__`.
topcenterbottom)rW   ztext-topmiddlebaselinerY   ztext-bottomTF)boldbolder600700800900normallighter100200300400500)rb   italicoblique            )serifz
sans-serifcursivefantasy)
dashedmediumDashDot
dashDotDothairdottedmediumDashDotDotdoubledashDotslantDashDotmediumDashedzdict[str, str] | None	inheritedNc                    Ub  U R                  U5      U l        OS U l        [        R                  " U R                  5      U l        g r,   )compute_cssr|   	functoolscache_call_uncached_call_cached)r-   r|   s     r.   r/   CSSToExcelConverter.__init__   s:     !--i8DN!DN &OOD,?,?@r1   c                $    U R                  U5      $ )a}  
Convert CSS declarations to ExcelWriter style.

Parameters
----------
declarations : str | frozenset[tuple[str, str]]
    CSS string or set of CSS declaration tuples.
    e.g. "font-weight: bold; background: blue" or
    {("font-weight", "bold"), ("background", "blue")}

Returns
-------
xlstyle : dict
    A style as interpreted by ExcelWriter when found in
    ExcelCell.style.
)r   )r-   declarationss     r.   __call__CSSToExcelConverter.__call__   s    &   ..r1   c                Z    U R                  XR                  5      nU R                  U5      $ r,   )r~   r|   build_xlstyle)r-   r   
propertiess      r.   r   "CSSToExcelConverter._call_uncached   s)     %%lNNC
!!*--r1   c                   ^ U R                  U5      U R                  U5      U R                  U5      U R                  U5      U R	                  U5      S.nSU4S jjmT" U5        U$ )N)	alignmentborderfillfontnumber_formatc                   > [        U R                  5       5       H6  u  pUc  X	 M  [        U[        5      (       d  M#  T" U5        U(       a  M4  X	 M8     g)z4Remove key where value is None, through nested dictsN)listrE   
isinstancedict)dkvremove_nones      r.   r   6CSSToExcelConverter.build_xlstyle.<locals>.remove_none   sA    QWWY94((N1D (r1   )r   dict[str, str | None]r4   r5   )build_alignmentbuild_border
build_fill
build_fontbuild_number_format)r-   propsoutr   s      @r.   r   !CSSToExcelConverter.build_xlstyle   s`    --e4''.OOE*OOE*!55e<
	! 	C
r1   c                h    UR                  S5      U R                  U5      U R                  U5      S.$ )Nz
text-align)
horizontalvertical	wrap_text)get_get_vertical_alignment_get_is_wrap_textr-   r   s     r.   r   #CSSToExcelConverter.build_alignment   s6      ))L144U;//6
 	
r1   c                j    UR                  S5      nU(       a  U R                  R                  U5      $ g )Nzvertical-align)r   VERTICAL_MAP)r-   r   vertical_aligns      r.   r   +CSSToExcelConverter._get_vertical_alignment  s.    #34$$((88r1   c                J    UR                  S5      c  g [        US   S;  5      $ )Nzwhite-space)nowrapprezpre-line)r   boolr   s     r.   r   %CSSToExcelConverter._get_is_wrap_text  s*    99]#+E-(0MMNNr1   c                0   S Vs0 s H  nUU R                  UR                  SU S35      UR                  SU S35      U R                  UR                  SU S35      5      5      U R                  UR                  SU S35      5      S._M     sn$ s  snf )N)rW   rightrY   leftzborder-z-stylez-widthz-color)r(   color)_border_styler   color_to_excel)r-   r   sides      r.   r    CSSToExcelConverter.build_border  s     ;

 ; ++IIvV45IIvV45''		GD62H(IJ
 ,,UYYf7M-NO  ;

 
	
 

s   BBc                0   Uc  Uc  Uc  g gUS;   a  gU R                  U5      nUc  gUS;   a  U$ US:X  a  gUS:X  a  US;   a  ggUS:X  a  US;   a  gg	XR                  ;   a  U R                  U   $ [        R                  " S
U< 3[        [        5       S9  g)Nnone)r   hidden)Ngrooveridgeinsetoutsetsolidrx   rv   )ru   thinrw   rr   r{   zUnhandled border style format: 
stacklevel)_get_width_nameBORDER_STYLE_MAPwarningswarnr   r   )r-   r(   widthr   
width_names        r.   r   !CSSToExcelConverter._border_style  s    " =U]} &&))%0
IIHH--%H--!+++((//MM1%;+-
 r1   c                P    U R                  U5      nUS:  a  g US:  a  gUS:  a  gg)Ngh㈵>g?r   gffffff@mediumthick)_width_to_float)r-   width_inputr   s      r.   r   #CSSToExcelConverter._get_width_nameX  s3    $$[14<S[S[r1   c                .    Uc  SnU R                  U5      $ )N2pt)_pt_to_float)r-   r   s     r.   r   #CSSToExcelConverter._width_to_floatb  s    =E  ''r1   c                f    UR                  S5      (       d   e[        UR                  S5      5      $ )Npt)endswithfloatrstrip)r-   	pt_strings     r.   r    CSSToExcelConverter._pt_to_floatg  s/    !!$''''Y%%d+,,r1   c                Z    UR                  S5      nUS;  a  U R                  U5      SS.$ g )Nzbackground-color)Ntransparentr   r   )fgColorpatternType)r   r   )r-   r   
fill_colors      r.   r   CSSToExcelConverter.build_fillk  s7     YY12
::#22:>wWW ;r1   c                ~    UR                  S5      n[        U[        5      (       a  UR                  SS5      OUnSU0$ )Nznumber-format   §;format_code)r   r   strreplace)r-   r   fcs      r.   r   'CSSToExcelConverter.build_number_formatr  s9    YY'&0S&9&9RZZc"rr""r1   c                p   U R                  U5      nU R                  U5      nU(       a  US   OS U R                  U5      U R                  U5      U R	                  U5      U R                  U5      SU;   a  SOS SU;   =(       d    S U R                  UR                  S5      5      U R                  U5      S.	$ )Nr   	underlinesinglezline-throughr   )	namefamilysizer\   ri   r   striker   shadow)	_get_font_names_get_decoration_select_font_family_get_font_size_get_is_bold_get_is_italicr   r   _get_shadow)r-   r   
font_names
decorations       r.   r   CSSToExcelConverter.build_fontw  s     ))%0
))%0
%/JqMT..z:''.%%e,))%0&1Z&?(T%3<((7);<&&u-
 	
r1   c                j    UR                  S5      nU(       a  U R                  R                  U5      $ g )Nzfont-weight)r   BOLD_MAP)r-   r   weights      r.   r    CSSToExcelConverter._get_is_bold  s+    =)==$$V,,r1   c                j    UR                  S5      nU(       a  U R                  R                  U5      $ g )Nz
font-style)r   
ITALIC_MAP)r-   r   
font_styles      r.   r   "CSSToExcelConverter._get_is_italic  s+    YY|,
??&&z22r1   c                L    UR                  S5      nUb  UR                  5       $ g)Nztext-decorationr=   )r   split)r-   r   r   s      r.   r   #CSSToExcelConverter._get_decoration  s)    YY01
!##%%r1   c                V    SU;   a#  [        [        R                  " SUS   5      5      $ g )Nztext-shadowz^[^#(]*[1-9])r   researchr   s     r.   r   CSSToExcelConverter._get_shadow  s(    E!		.%2FGHHr1   c                :   [         R                  " SUR                  SS5      5      n/ nU Hk  nUS S S:X  a  USS R                  SS5      nO/US S S:X  a  USS R                  S	S5      nOUR	                  5       nU(       d  MZ  UR                  U5        Mm     U$ )
Nz(?x)
            (
            "(?:[^"]|\\")+"
            |
            '(?:[^']|\\')+'
            |
            [^'",]+
            )(?=,|\s*$)
        zfont-family rk   "z\"'z\')r  findallr   r   stripappend)r-   r   font_names_tmpr   r   s        r.   r   #CSSToExcelConverter._get_font_names  s     IImR(
 
"DBQx3Abz))%5bqSAbz))%5zz|t!!$' # r1   c                P    UR                  S5      nUc  U$ U R                  U5      $ )Nz	font-size)r   r   )r-   r   r   s      r.   r   "CSSToExcelConverter._get_font_size  s+    yy%<K  &&r1   c                f    S nU H(  nU R                   R                  U5      nU(       d  M'    U$    U$ r,   )
FAMILY_MAPr   )r-   r   r   r   s       r.   r   'CSSToExcelConverter._select_font_family  s9    D__((.Fv 
 r1   c                    Uc  g U R                  U5      (       a  U R                  U5      $  U R                  U   $ ! [         a)    [        R
                  " SU< 3[        [        5       S9   g f = f)NzUnhandled color format: r   )_is_hex_color_convert_hex_to_excelNAMED_COLORSKeyErrorr   r   r   r   r-   r'   s     r.   r   "CSSToExcelConverter.color_to_excel  su    ;c""--c22	$$S)) 	MM*3'2+-
 	s   < 0A/.A/c                6    [        UR                  S5      5      $ )N#)r   
startswith)r-   color_strings     r.   r   !CSSToExcelConverter._is_hex_color  s    L++C011r1   c                    UR                  S5      nU R                  U5      (       a(  US   S-  US   S-  -   US   S-  -   R                  5       $ UR                  5       $ )Nr'  r   rl   rk   )lstrip_is_shorthand_colorupperr-   r)  codes      r.   r!  )CSSToExcelConverter._convert_hex_to_excel  s`    ""3'##L11GaK$q'A+-Q!;BBDD::<r1   c                    UR                  S5      n[        U5      S:X  a  g[        U5      S:X  a  g[        SU 35      e)zSCheck if color code is shorthand.

#FFF is a shorthand as opposed to full #FFFFFF.
r'     T   FzUnexpected color )r,  len
ValueErrorr/  s      r.   r-  'CSSToExcelConverter._is_shorthand_color  sC    
 ""3't9>Y!^0?@@r1   )r   r|   r,   )r|   
str | Noner4   r5   )r   z str | frozenset[tuple[str, str]]r4   dict[str, dict[str, str]])r   Mapping[str, str]r4   r9  )r   r:  r4   zdict[str, bool | str | None])r   r:  r4   r8  )r   r:  r4   zbool | None)r   r:  r4   z dict[str, dict[str, str | None]])r(   r8  r   r8  r   r8  r4   r8  )r   r8  r4   r8  )r   r8  r4   r   )r   r   r4   r   )r   r:  )r   r:  r4   r   )r   r:  r4   z$dict[str, bool | float | str | None])r   r:  r4   Sequence[str])r   r:  r4   zfloat | None)r   r;  r4   r3   )r'   r8  r4   r8  )r)  r   r4   r   )r)  r   r4   r   )+r6   r7   r8   r9   __doc__r   r"  r   r  r  r  rC   r   __annotations__r/   r   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!  r-  r<   ).0r(   s   00r.   rU   rU   m   s   " L L H" J 	J

E 	u
( %$A -K/</	"/*.<.	".0
O

&
	)
77(27;E7	7r(
-X#

&
	-
$
4'"2 A{	s   DrU   c                     \ rS rSrSrSrSr          S                     SS jjrS rSS jr	SS	 jr
SS
 jrSS jrSS jrSS jr\SS j5       rSS jrSS jrSS jr       S                 SS jjrSrg)ExcelFormatteri  a  
Class for formatting a DataFrame to a list of ExcelCells,

Parameters
----------
df : DataFrame or Styler
na_rep: na representation
float_format : str, default None
    Format string for floating point numbers
cols : sequence, optional
    Columns to write
header : bool or sequence of str, default True
    Write out column names. If a list of string is given it is
    assumed to be aliases for the column names
index : bool, default True
    output row names (index)
index_label : str or sequence, default None
    Column label for index column(s) if desired. If None is given, and
    `header` and `index` are True, then the index names are used. A
    sequence should be given if the DataFrame uses MultiIndex.
merge_cells : bool or 'columns', default False
    Format MultiIndex column headers and Hierarchical Rows as merged cells
    if True. Merge MultiIndex column headers only if 'columns'.
    .. versionchanged:: 3.0.0
        Added the 'columns' option.
inf_rep : str, default `'inf'`
    representation for np.inf values (which aren't representable in Excel)
    A `'-'` sign will be added in front of -inf.
style_converter : callable, optional
    This translates Styler styles (CSS) into ExcelWriter styles.
    Defaults to ``CSSToExcelConverter()``.
    It should have signature css_declarations string -> excel style.
    This is only called for body cells.
autofilter : bool, default False
    If True, add automatic filters to all columns.
i   i @  Nc                   SU l         X l        [        U[        5      (       d@  Xl        U R                  R                  5         UR                  nU
c
  [        5       n
Xl        OS U l        S U l        Xl	        Ub  [        [        U5      R                  UR                  5      5      (       d  [        S5      e[        [        U5      R                  UR                  5      5      [        [        U5      5      :w  a  [        S5      eUR!                  US9U l	        U R                  R                  U l        X0l        X`l        Xpl        XPl        [        U[*        5      (       d  US:w  a  [-        SU< S35      eXl        Xl        Xl        g )Nr   z,passes columns are not ALL present dataframez.Not all names specified in 'columns' are found)columnsrB  z!Unexpected value for merge_cells=.)
rowcounterna_repr   r   styler_computedatarU   style_converterdfr5  r   intersectionrB  r#  setreindexfloat_formatindexindex_labelheaderr   r6  merge_cellsinf_rep
autofilter)r-   rJ  rE  rN  colsrQ  rO  rP  rR  rS  rI  rT  s               r.   r/   ExcelFormatter.__init__  s7    "i((KKK  "B&"5"74C DK#'D uT{//

;<<MNN5;++BJJ78CD	NJOPPjjj.DGww(
&+t,,	1IA[N!DEE&$r1   c                   [        U5      (       a(  [        R                  " U5      (       a  U R                  nO[	        U5      (       ax  [        R
                  " U5      (       a  U R                  nOP[        R                  " U5      (       a  SU R                   3nO%U R                  b  [        U R                  U-  5      n[        USS 5      b  [        S5      eU$ )N-tzinfoz{Excel does not support datetimes with timezones. Please ensure that datetimes are timezone unaware before writing to Excel.)r   r   isnarE  r   isposinf_scalarrS  isneginf_scalarrN  r   getattrr6  r$  s     r.   _format_valueExcelFormatter._format_valueN  s    S>>gll3//++Cc]]&&s++ll((--$,,("".D--343$'3@ 
 
r1   c              #    #    U R                   R                  S:  a  U R                  (       d  [        S5      eU R                  (       d  U R
                  (       d  g U R                   nU R                  S;   nUR                  USS9n[        U5      nSnSnU R                  (       aL  [        U R                  R                  [        5      (       a#  U R                  R                  R                  S-
  n[        UR                  5       H  u  pg[        UUUS S9v   M     [        [        XAR                   UR"                  SS	95       H  u  nu  pn
U	R%                  U
5      nUR'                  5        HX  u  pS
u  pU(       a  US:  a  XeU-   U-   p[)        UX\-   S-   X   S [+        U R,                  SS 5      UUU R.                  UUS9
v   MZ     M     X`l        g 7f)Nrk   z]Writing to Excel with MultiIndex columns and no index ('index'=False) is not yet implemented.>   TrB  Fsparsifyinclude_namesr   rB   TstrictNNctx_columns
r%   r&   r'   r(   rG   rH   rI   rJ   r)   r*   )rB  nlevelsrO  NotImplementedError_has_aliasesrQ  rR  _format_multir   r   rJ  r   	enumeratenamesr"   ziplevelscodestakerE   r?   r]  rF  rI  rD  )r-   rB  merge_columns
level_strslevel_lengths	coloffsetlnumr   spansrp  level_codesvaluesispan_valr)   r*   s                   r.   _format_header_mi ExcelFormatter._format_header_mi`  s    <<!#::)D 
 !!T[[,,((,==**MQV*W
)*5	::*TWW]]J??--1I#GMM2JD	  3 3<~~w}}TJ3
.D.5+ [[-F${{}'1$
 X\+/Q1I"!)	&t{{M4H "&"6"6)% 	  -	3
( s   GGc              #    #    U R                   (       d  U R                  (       Gae  SnU R                  (       aT  Sn[        U R                  R                  [
        5      (       a)  [        U R                  R                  R                  5      nU R                  nU R                   (       a  [        [        U R                  5      U l        [        U R                  5      [        U R                  5      :w  a8  [        S[        U R                  5       S[        U R                  5       S35      eU R                  n[        U5       HB  u  p4[        U R                  X1-   US [        U R                   SS 5      SUU R"                  S9v   MD     g g 7f)Nr   rk   zWriting z cols but got z aliasesrg  r%   r&   r'   r(   rG   rH   rI   rJ   )rk  rQ  rO  r   rJ  r   r5  rn  rB  r   r   r6  rm  r?   rD  r]  rF  rI  )r-   rv  colnamescolindexcolnames        r.   _format_header_regular%ExcelFormatter._format_header_regular  s,    Izz	dggmmZ88 #DGGMM$7$7 8I||H  "8T[[9t{{#s4<<'88$"3t||#4"5 6##&t{{#3"4H>   ;;%.x%8!" ,&t{{M4H$"&"6"6	 	 &9% !,s   F
Fc                B  ^  [        T R                  [        5      (       a  T R                  5       nOT R	                  5       nSnT R
                  R                  R                  (       a  T R
                  R                  R                   Vs/ s H	  o3b  UOSPM     snS/[        T R                  5      -  -   n[        R                  " S S U 5       5      (       a*  U 4S j[        U5       5       nT =R                  S-  sl        [        R                  " X5      $ s  snf )Nr=   r  c                    U =(       a    U$ r,   r=   )xys     r.   <lambda>/ExcelFormatter._format_header.<locals>.<lambda>  s
    QW1Wr1   c              3  *   #    U  H	  oS :g  v   M     g7f)r  Nr=   )r>  r  s     r.   	<genexpr>0ExcelFormatter._format_header.<locals>.<genexpr>  s     6L1Bws   c              3  V   >#    U  H  u  p[        TR                  XS 5      v   M      g 7fr,   )r"   rD  )r>  r  r'   r-   s      r.   r  r    s*      )7 dooxdCC)7s   &)rk   )r   rB  r   r}  r  rJ  rO  rn  r5  r   reducerm  rD  	itertoolschain)r-   gengen2r  r%   s   `    r.   _format_headerExcelFormatter._format_header  s     dllJ//((*C--/C$&77==7;ww}}7J7JK7J!12-7JKODLL!O" "C  46L6LMM)23 1$s)) Ls   Dc                    [        U R                  R                  [        5      (       a  U R	                  5       $ U R                  5       $ r,   )r   rJ  rO  r   _format_hierarchical_rows_format_regular_rowsr-   s    r.   _format_bodyExcelFormatter._format_body  s5    dggmmZ001133,,..r1   c              #    #    U R                   (       d  U R                  (       a  U =R                  S-  sl        U R                  (       Ga  U R                  (       aI  [        U R                  [        [        [        R                  [        45      (       a  U R                  S   nO`U R                  (       a,  [        U R                  [        5      (       a  U R                  nO#U R                  R                  R                  S   n[        U R                  [        5      (       a  U =R                  S-  sl        U(       a,  U R                  SLa  [!        U R                  S-
  SUS 5      v   U R                  R                  n[        U R                  R                  ["        5      (       a$  U R                  R                  R%                  5       n['        U5       HC  u  p4[)        U R                  U-   SUS [+        U R,                  SS 5      USU R.                  S9v   ME     SnOSnU R1                  U5       S h  vN   g  N7f)Nrk   r   F	ctx_indexr  )rk  rQ  rD  rO  rP  r   r   tuplenpndarrayr   r   rJ  rn  rB  r   r"   r   to_timestamprm  r?   r]  rF  rI  _generate_body)r-   rP  index_valuesidxidxvalrv  s         r.   r  #ExcelFormatter._format_regular_rows  s    OOq O ::: J  4

E"B% % #..q1!!j1A1A3&G&G".."ggmm11!4$,,
331$t{{%7! 3QTJJ  77==L$''--55#ww}}99;(6"#-&t{{KF"&"6"6	 	  7 II&&y111s   H9I;I<Ic              #    #    U R                   (       d  U R                  (       a  U =R                  S-  sl        SnU R                  (       Ga  U R                  R                  R
                  nU R                  (       aE  [        U R                  [        [        [        R                  [        45      (       a  U R                  n[        U R                  [        5      (       a  U =R                  S-  sl        [        R                   " U6 (       a?  U R                  SLa0  [#        U5       H!  u  p4[%        U R                  S-
  X4S 5      v   M#     U R&                  (       Gaa  U R&                  S:w  GaP  U R                  R                  R)                  SSS9n[+        U5      n[-        UU R                  R                  R.                  U R                  R                  R0                  SS9 H  u  pxn	UR3                  U	UR4                  UR6                  S9n
[        U
S   [8        5      (       a  U
R;                  5       n
UR=                  5        Hh  u  pS	u  pUS:  a  U R                  U-   U-   S-
  nUn[?        U R                  U-   UX   S [A        U RB                  S
S 5      UUU RD                  UUS9
v   Mj     US-  nM     O[-        U R                  R                  SS06 H  n[#        U5       Hi  u  nn[        U[8        5      (       a  UR;                  5       n[?        U R                  U-   UUS [A        U RB                  S
S 5      UUU RD                  S9v   Mk     US-  nM     U RG                  U5       S h  vN   g  N7f)Nrk   r   FrB  Tra  rd  )
allow_fill
fill_valuerf  r  rh  re  r  )$rk  rQ  rD  rO  rJ  rn  rP  r   r   r  r  r  r   rB  r   comany_not_nonerm  r"   rR  rl  r   ro  rp  rq  rr  _can_hold_na	_na_valuer   r  rE   r?   r]  rF  rI  r  )r-   gcolidxindex_labelscidxr   rt  ru  rx  rp  ry  rz  r{  r|  r)   r*   indexcolvalsr  indexcolvals                     r.   r  (ExcelFormatter._format_hierarchical_rows  s    OOq O:::77==..LJ  4

E"B% %  $//
 $,,
331$ .4;;e3K"+L"9JD#DOOa$7TJJ #: D$4$4	$A!WW]]88! 9 
 !2* =25!GGMM((GGMM'' 	3.E; $[[##)#6#6#)#3#3 ) F "&)V44!'!4!4!6',{{}/9,
#a<)-1)<x)G!)KJ'.H* $! 3 ' &	"&'.t{{K'N$%$+*.*>*>'1%-  (5" qLGA3H %($Dt$DL,5l,C([%k6::*5*B*B*DK* $# 5 ' +"&'.t{{K'N$'$+*.*>*>	 	 -D qLG! %E$ &&w///s   M7N9M?:Nc                ,    [        U R                  5      $ )z1Whether the aliases for column names are present.)r   rQ  r  s    r.   rk  ExcelFormatter._has_aliasesT  s     DKK((r1   c              #  8  #    [        [        U R                  5      5       Ht  nU R                  R                  S S 2U4   n[        U5       HE  u  pE[        U R                  U-   X!-   US [        U R                  SS 5      UUU R                  S9v   MG     Mv     g 7f)Nctxr  )ranger5  rB  rJ  ilocrm  r?   rD  r]  rF  rI  )r-   rv  colidxseriesr{  r'   s         r.   r  ExcelFormatter._generate_bodyY  s     C-.FWW\\!V),F#F+"!+*&t{{E4@""&"6"6	 	 , /s   BBc              #     #    [         R                  " U R                  5       U R                  5       5       H'  nU R	                  UR
                  5      Ul        Uv   M)     g 7fr,   )r  r  r  r  r^  r'   )r-   cells     r.   get_formatted_cells"ExcelFormatter.get_formatted_cellsi  sH     OOD$7$7$94;L;L;NOD))$((3DHJ Ps   A A"c                    US:  a  [        SU 35      eSnUS:  d  U(       d0  [        US5      u  p[        SU-   5      U-   nUS:  a  M'  U(       d  M0  U$ )a  
Convert 0-based column index to Excel column name.

Parameters
----------
index : int
    The numeric column index to convert to an Excel column name.

Returns
-------
column_name : str
    The column name corresponding to the index.

Raises
------
ValueError
    Index is negative
r   zIndex cannot be negative: r     A   )r6  divmodchr)r-   rO  column_name	remainders       r.   
_num2excelExcelFormatter._num2exceln  sc    & 199%ABBai{%eR0Eb9n-;K ai{{ r1   c	           
     ^   SSK Jn	  U R                  R                  u  pXR                  :  d  XR
                  :  a+  [        SU
 SU SU R                   SU R
                   35      eU R                  (       Ga5  SnSnUS:X  a  SnOU R                  (       a  Sn[        U R                  R                  [        5      (       a?  U R                  (       a  [        S5      eU R                  R                  R                  S-
  n[        U R                  [        5      (       aK  U R                  (       a  [        S5      eU R                  R                  nU R                  R                  S-   nOSnU R                  U5       X<-    3nU R                  XK-   U-   5      nU X:-   U-    3nU S	U 3nOS
nUc  0 nU R                  5       n[        X5      (       a  SnOU	" UUUUS9nSn UR!                  UUUUUUS9  U(       a  UR#                  5         g
g
! U(       a  UR#                  5         f f = f)a  
writer : path-like, file-like, or ExcelWriter object
    File path or existing ExcelWriter
sheet_name : str, default 'Sheet1'
    Name of sheet which will contain DataFrame
startrow :
    upper left cell row to dump data frame
startcol :
    upper left cell column to dump data frame
freeze_panes : tuple of integer (length 2), default None
    Specifies the one-based bottommost row and rightmost column that
    is to be frozen
engine : string, default None
    write engine to use if writer is a path - you can also set this
    via the options ``io.excel.xlsx.writer``,
    or ``io.excel.xlsm.writer``.

storage_options : dict, optional
    Extra options that make sense for a particular storage connection, e.g.
    host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
    are forwarded to ``urllib.request.Request`` as header options. For other
    URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
    forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
    details, and for more examples on storage options refer `here
    <https://pandas.pydata.org/docs/user_guide/io.html?
    highlight=storage_options#reading-writing-remote-files>`_.

engine_kwargs: dict, optional
    Arbitrary keyword arguments passed to excel engine.
r   r   z-This sheet is too large! Your sheet size is: z, z Max sheet size is: rk   zwExcel filters merged cells by showing only the first row. 'autofilter' and 'merge_cells' cannot be used simultaneously.r  :NF)enginestorage_optionsengine_kwargsT)startrowstartcolfreeze_panesautofilter_range)pandas.io.excelr    rJ  shapemax_rowsmax_colsr6  rT  rO  r   r   rR  ri  rB  r  r  _write_cellsclose)r-   writer
sheet_namer  r  r  r  r  r  r    num_rowsnum_colsstartrowsoffsetendrowsoffsetindexoffsetstartautofilter_end_columnendr  formatted_cells	need_saves                        r.   writeExcelFormatter.write  s+   R 	0!WW]]mm#x--'??zH: V&&*mm_Bt}}oG 
 ???OM1}dggmmZ88''(6  '+ggmm&;&;a&?dllJ77''(6  +/,,*>*>(,(<(<q(@ !x01(2L1MNE$(OOH4G+4U$V!*+H,?-,O+PQC"'#/# M224f**I  /+	F I	!!)!1     y s   %H H,)rT  rB  rJ  rN  rQ  rO  rP  rS  rR  rE  rD  rI  rF  )
r  NNTTNFinfNF)rE  r   rN  r8  rU  zSequence[Hashable] | NonerQ  zSequence[Hashable] | boolrO  r   rP  zIndexLabel | NonerR  r   rS  r   rI  rR   rT  r   r4   r5   )r4   Iterable[ExcelCell])r4   r   )rv  r2   r4   r  )rO  r2   r4   r   )Sheet1r   r   NNNN)r  z)FilePath | WriteExcelBuffer | ExcelWriterr  r   r  r2   r  r2   r  ztuple[int, int] | Noner  r8  r  zStorageOptions | Noner  rQ   r4   r5   )r6   r7   r8   r9   r<  r  r  r/   r^  r}  r  r  r  r  r  propertyrk  r  r  r  r  r<   r=   r1   r.   r@  r@    sv   #J HH
 #'*.,0)--2+/ 0% 0% !	0%
 (0% *0% 0% '0% +0% 0% )0% 0% 
0%d$1f>*,/,2\V0p ) ) 
> #/3!15%)u9u u 	u
 u -u u /u #u 
u ur1   r@  )8r<  
__future__r   collections.abcr   r   r   r   r   r   r  r  typingr	   r
   r   r   numpyr  pandas._libs.libr   pandas.util._exceptionsr   pandas.core.dtypesr   pandas.core.dtypes.commonr   r   pandasr   r   r   r   r   pandas.core.commoncorecommonr  pandas.io.formats._color_datar   pandas.io.formats.cssr   r   pandas.io.formats.formatr   pandas._typingr   r   r   r   r   r    r"   r?   rU   r@  r=   r1   r.   <module>r     s    #    	 
   ) 4 &
  !   5 7  #! !*K9 K2CA CALL Lr1   