4

How to rename the "key" to null from the last DF result?

enter image description here

2 Answers 2

1

Use DataFrame.rename_axis():

df.pivot(index='Metric', columns='key', values='value').reset_index()\
  .rename_axis(columns=None)
Sign up to request clarification or add additional context in comments.

Comments

0

I would try:

df1 = df.rename(columns = {"" : "Metric", "seg1", ""seg2})

Of course, you change "df1" to fit your final result.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.