I have to insert pandas dataframe into mysql table. Problem here is that dataframe consist different column names that mysql table but matches same number of columns. Is there any workaround to use .to_sql() method?
Here is my approach:
engine = create_engine("mysql+pymysql://{user}:{pw}@localhost/{db}"
.format(user="user1",
pw="pwdtest",
db="myTable"))
df.to_sql('myTable', con = engine, if_exists = 'append', chunksize=1000, index = False)