Commit d7f015ec authored by 张彦钊's avatar 张彦钊

Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline

删除数据库双写
parents 4a6010bd e3ba66ef
...@@ -4,17 +4,12 @@ ...@@ -4,17 +4,12 @@
import pandas as pd import pandas as pd
from sqlalchemy import create_engine from sqlalchemy import create_engine
data=pd.read_excel('knowledge_network.xls') data=pd.read_excel('nose.xls')
print(data.head()) print(data.head())
# # 初始化数据库连接,使用pymysql模块 # # 初始化数据库连接,使用pymysql模块
engine = create_engine(str(r"mysql+mysqldb://%s:" + '%s' + "@%s:%s/%s%s") % ("root","3SYz54LS9#^9sBvC",'10.66.157.22', "4000", "jerry_prod","?charset=utf8")) engine = create_engine(str(r"mysql+mysqldb://%s:" + '%s' + "@%s:%s/%s%s") % ("root","3SYz54LS9#^9sBvC",'10.66.157.22', "4000", "jerry_prod","?charset=utf8"))
# engine = create_engine('mysql+pymysql://root:147369@localhost:3306/mydb') # engine = create_engine('mysql+pymysql://root:147369@localhost:3306/mydb')
data.to_sql('Knowledge_network',con=engine,if_exists='append',index=False) data.to_sql('Knowledge_network',con=engine,if_exists='append',index=False)
# # 读取本地CSV文件
# df = pd.read_csv("E://mpg.csv", sep=',')
#
# # 将新建的DataFrame储存为MySQL中的数据表,不储存index列
# df.to_sql('mpg', engine, index= False)
print("Write to MySQL successfully!") print("Write to MySQL successfully!")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment