首页 > 解决方案 > MySQLdb._exceoption.OperationalError 由于夏令时

问题描述

我无法将我的数据框上传到 mySQL 数据库。错误消息表明时移存在某种问题(我来自德国),尽管我在 utc 中创建了一个日期范围,并且我还想以 utc 时间将数据保存在我的数据库中。

谢谢你的帮助

idx = pd.date_range(start=f'{year}-01-01', periods=len(df), freq='H', tz='utc').shift(-1, freq='H')

df.set_index(idx, inplace=True)

df.to_sql('intraday_continuous', con=engine, index=True, if_exists='replace')

sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1292, "Incorrect datetime value: '2019-03-31 02:00:00' for column 'index' at row 273") 

标签: pythonmysql

解决方案


推荐阅读