File tree Expand file tree Collapse file tree 1 file changed +3
-33
lines changed Expand file tree Collapse file tree 1 file changed +3
-33
lines changed Original file line number Diff line number Diff line change @@ -628,39 +628,9 @@ def _infer_columns(
628628 this_columns .append (c )
629629
630630 if not have_mi_columns :
631- counts : DefaultDict = defaultdict (int )
632- # Ensure that regular columns are used before unnamed ones
633- # to keep given names and mangle unnamed columns
634- col_loop_order = [
635- i
636- for i in range (len (this_columns ))
637- if i not in this_unnamed_cols
638- ] + this_unnamed_cols
639-
640- # TODO: Use pandas.io.common.dedup_names instead (see #50371)
641- for i in col_loop_order :
642- col = this_columns [i ]
643- old_col = col
644- cur_count = counts [col ]
645-
646- if cur_count > 0 :
647- while cur_count > 0 :
648- counts [old_col ] = cur_count + 1
649- col = f"{ old_col } .{ cur_count } "
650- if col in this_columns :
651- cur_count += 1
652- else :
653- cur_count = counts [col ]
654-
655- if (
656- self .dtype is not None
657- and is_dict_like (self .dtype )
658- and self .dtype .get (old_col ) is not None
659- and self .dtype .get (col ) is None
660- ):
661- self .dtype .update ({col : self .dtype .get (old_col )})
662- this_columns [i ] = col
663- counts [col ] = cur_count + 1
631+ from pandas .io .common import dedup_names
632+ this_columns = dedup_names (this_columns , is_potential_multiindex = False )
633+
664634 elif have_mi_columns :
665635 # if we have grabbed an extra line, but its not in our
666636 # format so save in the buffer, and create an blank extra
You can’t perform that action at this time.
0 commit comments