到目前为止,我已经成功地将python查询结果保存到csv文件中。一切都很好。
但我现在正在努力将结果保存到MariaDB中。
The dataframe that keeps showing error messages whenever I try to save it into MariaDB
我真的不能理解的是,当我将时间设置为'2017-02-01 to 2020-04-20‘时,保存相同的数据没有问题,但是当我将起始时间线切换到2017-02-01之前的任何日期时(例如,'2015-06-15 to 2020-04-20'),即使我有从2015-08-21开始的数据,也会弹出错误消息sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1054, "Unknown column 'inf' in 'field list'")。
The dataframe well saved into MariaDB
正如你所看到的,从2007-02-01开始的数据帧已经传输到MariaDB,没有任何问题,我在python数据帧或SQL表中都没有名为'inf‘的列。
[SQL: INSERT INTO equitiesdailyprice (`Quote`, `Date`, `Close`, `PriceDiff`, `Volume`, `VolDiff`, `Open`, `High`, `Low`)
VALUES (%(Quote)s, %(Date)s, %(Close)s, %(PriceDiff)s, %(Volume)s, %(VolDiff)s, %(Open)s, %(High)s, %(Low)s)]发布于 2021-03-29 22:25:38
问题是inf在内部是无穷大的浮点数,而您的python连接器(可能是pymysql?)正在将其转换为inf,而MariaDB不知道如何在列中表示无穷大。
https://stackoverflow.com/questions/61334177
复制相似问题