import pandas as pd from sqlalchemy import create_engine import numpy as np w=np.array([1,2,3]) datas = pd.DataFrame(w) print(datas) engine = create_engine("mysql+pymysql://root:1234567890@localhost:3306/studentmemo?charset=utf8") con = engine.connect() datas.to_sql(name="mytab", con=con, if_exists="append",index=False) con.close() studentmemo是数据库名 root是用户名 1234567890是密码
标签:engine,数据库,写入,import,pandas,datas,con From: https://www.cnblogs.com/hahaah/p/17273948.html