'how to remove the value heading in pivot table in pandas?
I want to create a pivot table and for that I have written the code below
pvt_df = df1.pivot_table(index=["Title"],values=['Rating'],columns=["Gender"], aggfunc='mean')
pvt_df.head()
I am getting the output as
but I want the desired output as
I just want to remove the "Rating" which is values heading.I tried few but couldn't get it.Can anyone please help me with this, It would be a great help
Solution 1:[1]
Ok, Somehow I could find my answer after looking into this https://pandas.pydata.org/docs/user_guide/reshaping.html. If you have a value heading above all.You can get rid of it by using below I just wrote this
pvt_df["Rating"].head()
After adding this I got my desired output
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pratharan Reddy |


