I have a dataframe like this which is around 10million rows
Date AirPressure SoilMoisture Temperature Humidity WindSpeed WindDirection Source
2010-01-01 xxx. xxx xxx xxx. xxx. xxx. Location1
2010-01-02 xxx. xxx xxx xxx. xxx. xxx. Location1
2010-01-03 xxx. xxx xxx xxx. xxx. xxx. Location1
....
2010-01-01 xxx. xxx xxx xxx. xxx. xxx. Location2
...
2020-10-10 xxx. xxx xxx xxx. xxx. xxx. Location8595
I need to pivot it so that it looks like this,
Date AirPressure-Location1 SoilMoisture-Location1.....WindDirection-Location8595
2010-01-01 xxx. xxx xxx
......
2020-10-10 xxx. xxx xxx
I tried frame = df.pivot_table(index='Date', columns='Source')
,
But I am left with
AirPressure... WindDirection
Date Location1 Location2.......Location8593 Location8594 Location8595
2010-01-01 xxx. xxx xxx xxx. xxx.
2010-01-02 xxx. xxx xxx xxx. xxx.
2010-01-03 xxx. xxx xxx xxx. xxx.
....
2010-01-01 xxx. xxx xxx xxx. xxx.
...
2020-10-10 xxx. xxx xxx xxx. xxx.
How can I fix my code?