I have the following pandas dataframe:
I would like to convert it to an xarray dataset, but when I use the code below, it uses the date column as a variable.
dsn = nino.to_xarray()
print(dsn)
I need the date column to be the time coordinate (ie datetime64). How do I do this?
Further to this, I tried the following:
dsn = dsn.assign_coords(time=dsn['DATE'])
dsn = dsn.drop('YR') dsn = dsn.drop('MON')
dsn = dsn.drop('DATE')
But when I try select certain years (using dsn.sel(time=slice()) I get an error: 'no index found for coordinate time'. Any guidance would be greatly appreciated?