Skip to content
Advertisement

Import Data from .csv file into mysql using python

I am trying to import data from two columns of a .csv file (time hh:mm, float). I created a database and a table in mysql.

JavaScript

If I run the program with executemany(), result is the following:

  • [’01:00′, ‘1’]
  • ‘-1 was inserted.’

and after this I do get the error code: Not all parameters were used again.

When I try the same thing with the execute() operator, no error is shown, but the data is not inserted in the table of my database.

Here you can see the input data:

input data

Advertisement

Answer

executemany takes a statement and a sequence of sets of parameters.
Try this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement