@@ -3227,7 +3227,6 @@ def to_latex(
32273227    def  to_latex (
32283228        self ,
32293229        buf : FilePath  |  WriteBuffer [str ] |  None  =  None ,
3230-         * ,
32313230        columns : Sequence [Hashable ] |  None  =  None ,
32323231        col_space : ColspaceArgType  |  None  =  None ,
32333232        header : bool_t  |  Sequence [str ] =  True ,
@@ -3460,7 +3459,7 @@ def to_latex(
34603459        column_format_ : dict [str , Any ] =  {"axis" : 1 , ** base_format_ }
34613460
34623461        if  isinstance (float_format , str ):
3463-             float_format_  =  lambda  x : float_format  %  x 
3462+             float_format_ :  Callable   |   None  =  lambda  x : float_format  %  x 
34643463        else :
34653464            float_format_  =  float_format 
34663465
@@ -3470,8 +3469,9 @@ def _wrap(x, alt_format_):
34703469            else :
34713470                return  alt_format_ (x )
34723471
3472+         formatters_ : list  |  tuple  |  dict  |  Callable  |  None  =  None 
34733473        if  isinstance (formatters , list ):
3474-             formatters  =  {
3474+             formatters_  =  {
34753475                c : functools .partial (_wrap , alt_format_ = formatters [i ])
34763476                for  i , c  in  enumerate (self .columns )
34773477            }
@@ -3483,36 +3483,36 @@ def _wrap(x, alt_format_):
34833483            if  column_formatter  is  not None :
34843484                column_format_ .update ({"formatter" : column_formatter })
34853485
3486+             formatters_  =  formatters 
34863487            float_columns  =  self .select_dtypes (include = "float" ).columns 
34873488            for  col  in  [c  for  c  in  float_columns  if  c  not  in formatters .keys ()]:
3488-                 formatters .update ({col : float_format_ })
3489+                 formatters_ .update ({col : float_format_ })
34893490        elif  formatters  is  None  and  float_format  is  not None :
3490-             formatters  =  functools .partial (_wrap , alt_format_ = lambda  v : v )
3491-         else :
3492-             formatters  =  None 
3491+             formatters_  =  functools .partial (_wrap , alt_format_ = lambda  v : v )
34933492        format_index_  =  [index_format_ , column_format_ ]
34943493
34953494        # Deal with hiding indexes and relabelling column names 
3496-         hide , relabel_index  =  [], []
3495+         hide_ : list [dict ] =  []
3496+         relabel_index_ : list [dict ] =  []
34973497        if  columns :
3498-             hide .append (
3498+             hide_ .append (
34993499                {
35003500                    "subset" : [c  for  c  in  self .columns  if  c  not  in columns ],
35013501                    "axis" : "columns" ,
35023502                }
35033503            )
35043504        if  header  is  False :
3505-             hide .append ({"axis" : "columns" })
3505+             hide_ .append ({"axis" : "columns" })
35063506        elif  isinstance (header , (list , tuple )):
3507-             relabel_index   =   {"labels" : header , "axis" : "columns" }
3507+             relabel_index_ . append ( {"labels" : header , "axis" : "columns" }) 
35083508            format_index_  =  [index_format_ ]  # column_format is overwritten 
35093509
35103510        if  index  is  False :
3511-             hide .append ({"axis" : "index" })
3511+             hide_ .append ({"axis" : "index" })
35123512        if  index_names  is  False :
3513-             hide .append ({"names" : True , "axis" : "index" })
3513+             hide_ .append ({"names" : True , "axis" : "index" })
35143514
3515-         render_kwargs  =  {
3515+         render_kwargs_  =  {
35163516            "hrules" : True ,
35173517            "sparse_index" : sparsify ,
35183518            "sparse_columns" : sparsify ,
@@ -3533,11 +3533,11 @@ def _wrap(x, alt_format_):
35333533
35343534        return  self ._to_latex_via_styler (
35353535            buf ,
3536-             hide = hide ,
3537-             relabel_index = relabel_index ,
3538-             format = {"formatter" : formatters , ** base_format_ },
3536+             hide = hide_ ,
3537+             relabel_index = relabel_index_ ,
3538+             format = {"formatter" : formatters_ , ** base_format_ },
35393539            format_index = format_index_ ,
3540-             render_kwargs = render_kwargs ,
3540+             render_kwargs = render_kwargs_ ,
35413541        )
35423542
35433543    def  _to_latex_via_styler (
0 commit comments