I am using pd.read_fwf
and am provided with a list of widths for each of the columns. There are several columns name "Filler" which prevents me from reading in the dataframe because ValueError: Duplicate names are not allowed.
How can I generate suffixes for each of the Filler colnames so that I can properly use pd.read_fwf
?
I have a dataframe of Column Names and Width:
col_widths = pd.DataFrame({'name': ['Filler', 'Col A', 'Filler', 'Col B'],'width': [2, 8, 4, 6]})
name width
0 Filler 2
1 Col A 8
2 Filler 4
3 Col B 6