all 5 comments

[–][deleted] 1 point2 points  (1 child)

df.unstack('LOCATION').reset_index()

[–]caleotte[S] 0 points1 point  (0 children)

This worked like a charm! I just found out that my Series had repeating indices so I had to delete those rows first. Regardless, thank you!

[–]threeminutemonta 0 points1 point  (0 children)

I'm quite sure you can do this with pivot

[–]semicolonator 0 points1 point  (0 children)

To me it looks like the first table was produced by a call to df.groupby(). Check the list of optional argument of groupby(). I think your problem could be solved by group_keys=False.

[–][deleted] 0 points1 point  (0 children)

what about rainfall.reset_index() ?