How to rename the "key" to null from the last DF result?
CodePudding user response:
df.pivot(index='Metric', columns='key', values='value').reset_index()\
.rename_axis(columns=None)
CodePudding user response:
I would try:
df1 = df.rename(columns = {"" : "Metric", "seg1", ""seg2})
Of course, you change "df1" to fit your final result.