import pandas as pd from sqlalchemy import create_engine # read in the Statal file df = pd.read_stata('1.dta') # create a connection to the MySQL database engine = create_engine('mysql://user:password@host:port/database') # write the data to a table in the MySQL database df.to_sql('table_name', con=engine, if_exists='replace')
标签:engine,database,python,create,df,STATA,MySQL,table From: https://www.cnblogs.com/xkdn/p/17234266.html