0

I have a dataframe like this

Date Region Parameter Area Mean
2005-01-01 NSW Precipitation 8.002343e+05 0.044274
2005-01-01 NSW RelativeHumidity 8.002343e+05 36.355567
2005-01-01 NSW SoilWaterContent 8.002343e+05 0.170931
2005-01-01 NSW SolarRadiation 8.002343e+05 26.749389
2005-01-01 NSW Temperature 8.002343e+05 27.341182

I want to transpose it into this

Date Region PrecipitationArea RelativeHumidityArea SoilWaterContentArea SolarRadiationArea TemperatureArea PrecipitationMean RelativeHumidityMean SoilWaterContentMean SolarRadiationMean TemperatureMean
2005-01-01 NSW 8.002343e+05 8.002343e+05 8.002343e+05 8.002343e+05 8.002343e+05 0.044274 36.355567 0.170931 26.749389 27.341182

Should I be using pivot or melt in this situation?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Amando Xu
  • 1
  • 1

0 Answers0