由于上周六/周日转换为夏令时,从 UTC 转换为 CET 时,我的时间戳字段出现以下错误:
AmbiguousTimeError: Cannot infer dst time from 2020-07-31 11:17:18+00:00, try using the 'ambiguous' argument
#将时间戳字段转换为 CET(欧洲、柏林)
df['timestamp_berlin_time'] = df['timestamp'].dt.tz_localize('Europe/Berlin')
我尝试了以下片段:
df['timestamp_berlin_time'] = df['timestamp'].dt.tz_localize('CET',ambiguous='infer')
但这给了我这个错误:
AmbiguousTimeError: 2020-07-31 11:17:18+00:00
数据样本:
0 2020-07-31 11:17:18+00:00
1 2020-07-31 11:17:18+00:00
2 2020-08-31 16:26:42+00:00
3 2020-10-20 07:28:46+00:00
4 2020-10-01 22:11:33+00:00
名称:时间戳,数据类型:datetime64[ns,UTC]
慕田峪9158850
相关分类