Reputation: 43
How can I do to replace what is marked in red by row 0 (Image 1)? I tried with index_col = 0
and header=0
but the result is different from what I want
Upvotes: 0
Views: 156
Reputation: 7520
Here is an example, column name is taken from row 1
df = pd.DataFrame( {'a': ['b','c']})
df.columns = df.iloc[0].tolist()
This doesn't remove row 0, so if you want to drop that you can go:
df = df.iloc[1:]
Upvotes: 2