I have a problem converting a Xarray dataset into a Pandas dataframe. The thing is that when I convert into a pd dataframe, pandas don't see the right amount of columns. During the conversion I switch from 5 columns (lat, lon, time, sst, time_bnds) to only 2 columns.
Here is my code
PATH = os.path.join (DIR, 'sst.mnmean.nc')
data=xr.open_dataset(PATH)
data_pd = data.to_dataframe(dim_order=None)
As you can see pandas sees only 2 columns even though there are 6 variables.
I was expecting to see the 5 exact same columns in my pandas dataframe, which is not the case. To be clear, I just want to work with sst variable (sea surface temperature) and time bnds which is the timestamp
(I know that coordinates are considered as index, I tried reset_index()
but it doesn't work)