How to Covert from proleptic Gregorian to datetime

问题描述 投票:0回答:0

我在使用 prolepticGregorian(Comming for netCDF4)将数据帧转换为日期时间时遇到问题

i3h.index = pd.to_datetime(i3h.index, format='%Y-%m-%d %')

错误是

<class 'cftime._cftime.DatetimeProlepticGregorian'> is not convertible to datetime

怎么可能做到?我需要它来使用 .resample("1H").mean()

Dataframe 如下所示

i3h

2022-01-01 01:30:00      0.000000
2022-01-01 04:30:00      0.000000
2022-01-01 07:30:00     17.655130
2022-01-01 10:30:00    182.508820
2022-01-01 13:30:00    210.705002
   
2071-12-31 10:30:00     60.053749
2071-12-31 13:30:00     50.852924
2071-12-31 16:30:00      8.414156
2071-12-31 19:30:00      0.000000
2071-12-31 22:30:00      0.000000

Name: S, Length: 146096, dtype: float32

最好的问候

塞尔吉奥

python pandas datetime netcdf4 gregorian-calendar
© www.soinside.com 2019 - 2024. All rights reserved.