import pandas as pd
from sqlalchemy import create_engine

data3={"lsit1":[1,2],"lsit2":[3,4],"lsit3":[5,6]}   # use tuple tuple or dictionary list


df=pd.DataFrame(data3)

df.to_csv('weiboi.csv', encoding='gb2312', index = False) #insert into csv
df.to_excel('weiboi.xlsx', encoding='gb2312', index=False,sheet_name="sheet2")#insert into excel
yconnect = create_engine('mysql+pymysql://root:Aa1234@127.0.0.1:3306/ptos?charset=utf8')
pd.io.sql.to_sql(datatosql, 'tablename', yconnect, schema='ptos', if_exists='append')  #insert into sql 

  

相关文章:

  • 2021-10-14
  • 2021-10-27
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
猜你喜欢
  • 2021-12-26
  • 2021-09-20
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2021-08-10
  • 2021-09-28
相关资源
相似解决方案