I have a dataframe with 3 columns and datatypes: Datetime (Datetime dtype), Area (string), Value (float).
I want to pivot it so I get separate columns for each unique entry in Area.
df_pivot = pd.pivot(df,index='Datetime',columns='Area','values='Value')
Now I get the following error
ValueError: Index contains duplicate entries, cannot reshape.
I drop duplicates without subsetting and try again but get the same result.
I try to find the offending entries with no success:
duplicates = df[df.duplicated(subset=['Datetime','Area','Value'], keep=False)]
This returns an empty dataframe
So I try resetting the index and repeating subsetting with the nex index:
duplicates = df[df.duplicated(subset=['Datetime','Area','Value','index'], keep=False)]
I get the same result, an empty dataframe and an unpivottable df.
Is there some other way to find the offending entries?
1