1

我正在尝试插入具有这种格式的数据框

{'id': 67972, 'year': 2013, 'country_id': 432, 'country': 'Mali', 'best': 31, 'type_of_violence': 1, 'date_start': '2013-01-11', 'geometry': 'POINT (-3.89474 14.94329)', 'ISO3': 'MLI', 'ISO2': 'ML', 'FIPS': 'ML', 'month': 1}

使用 to_sql 进入 mysql。但是,我收到了这个错误

sqlalchemy.exc.InterfaceError: (mysql.connector.errors.InterfaceError) Failed executing the operation; Python type Point cannot be converted

显然,'geometry': 'POINT (-3.89474 14.94329)'没有转换。

我一直在寻找同样的错误,人们建议 to_sql 应该解决这个问题,但显然它不起作用。我使用 sqlalchemy 进行连接。任何人都可以为此提供任何指示吗?

4

0 回答 0