1

I'm trying to insert a dataframe which has this format

{'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}

into a mysql using to_sql. However, I got this error

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

Obviously the 'geometry': 'POINT (-3.89474 14.94329)' is not converting.

I have been looking around for the same error and people suggested that to_sql should take care of the problem but apparently it isn't working. I used sqlalchemy for connection. Can anyone give any pointers for this?

K.U
  • 293
  • 1
  • 4
  • 15

0 Answers0