import pandas as pd
from sqlalchemy import create_engine
conn = create_engine('mysql+mysqldb://root:password@localhost:3306/databasename?charset=utf8')
df = pd.DataFrame()
df["A"] = [1,2,3,4]
df["B"] = [11,22,33,44]
df.to_sql('表名',con=engine,if_exists='replace/append/fail',index=False)