I need help to get this working. I have a pd.DataFrame (df)
, which I need to load to a MySQL database. I don\'t understand what the error message means and how
You can write pandas dataframe in mysql table using mysql flavour(with DBAPI connection) in following ways
step1: install mysqldb module -
$ sudo apt-get install python-dev libmysqlclient-dev
then
$ pip install MySQL-python
step2: make a connection with mysql
import MySQLdb
con = MySQLdb.connect("hostname","username","password","databasename")
step3: write pandas dataframe in mysql table by using df.to_sql
df.to_sql('TableName',con = con,flavor='mysql',if_exists='replace', chunksize=100)