I have an netcdf file,I read it with xarray module.I want to make a plot from it. But the problem is the datatype of my time is datetime.datetime object and I am having problem with plotting. I want to change the datatype to datetime64. I tried using pandas pd.to_datetime and also using astype('datetime'). But I am having errors. I am displaying my errors below. Plz help me. ds['time'] = pd.to_datetime(ds['time']) error:<class 'cftime._cftime.DatetimeNoLeap'> is not convertible to datetime
ds['time'] = ds['time'].astype('datetime64') error:Cannot cast datetime.datetime object from metadata [us] to according to the rule 'same_kind'