I have a Pandas dataframe df
with 102 columns. Each column is named differently, say A, B, C
etc. to give the original dataframe following structure
Column A. Column B. Column C. ....
Row 1.
Row 2.
---
Row n
I would like to change the columns names from A, B, C
etc. to F1, F2, F3, ...., F102
. I tried using df.columns but wasn't successful in renaming them this way. Any simple way to automatically rename all column names to F1 to F102
automatically, insteading of renaming each column name individually?
["F"+str(i+1) for i in range(df.shape[1])]
that way you never need to explicitly write the number of columns. – Atrophied