'Turning secondary keys into primary keys in dataframe

Pandas Dataframe: Turning secondary keys into primary keys in Python

I would like to pass the secondary keys of this plot as primary key. Currently, the primary key is 'ustar' but I want 'time', 'latitude' and 'longitude' to be the primary keys. How do I do this?

ustar = ds['ustar'].to_dataframe()
print(ustar)

print(ustar)

Thanks for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source