I am struggling with pivot table and multi index.
I made a pivot table from a simple dataset.
I wanted the columns "cat, lobster, poney, unicorn" on the same line as "place".
So I tried the "reset_index" method but I now have "features 3" as a title.
I would like to make a simple data frame now (just like in the beginning), without the "features 3" title. Just a normal index like in the first dataframe (with no name and only number of row).
import pandas as pd
import numpy as np
data = [['Wonderland', 'lala','poney',13], ['Heaven', 'lala','unicorn',8], ['Hell', 'lala','cat',13],['Mars', 'lala','lobster',10]]
df = pd.DataFrame(data=data,columns=['Place','Features2','Features3','my_result'])
df
df = pd.pivot_table(df,index=["Place"],values=["my_result"],columns=["Features3"])
df = df["my_result"]
df
df2=df.reset_index()
df2
I would like a simple data frame without the "features 3" title. Just a normal index like in the first dataframe (with no name and only number of row).