in process of using pivot table, I found there not able to export the pivot result to a dataframe
on the other hand, how to get the 1st column and 2rd column result from pivot result table?
thank you.
in process of using pivot table, I found there not able to export the pivot result to a dataframe
on the other hand, how to get the 1st column and 2rd column result from pivot result table?
thank you.
I solved this by myself.
to get a new dataframe from pivot_table, we can do like this:
df=df.pivot_table(index=["a"], values=["b"])
df.reset_index()
#to obtain the 1st column content
df.reset_index().iloc[:,[0]]
#to obtain the 2rd column content
df.reset_index().iloc[:,[1]]