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

change

parent 301fbcd0
......@@ -2,6 +2,7 @@
import pymysql
import datetime
import pandas as pd
from sqlalchemy import create_engine
def get_yesterday_date():
......@@ -57,5 +58,7 @@ if __name__ == "__main__":
df = df.rename(columns={0:"cid",1:"exp",2:"click"})
df["click"] = df["click"].fillna(0)
df["ctr"] = df["click"]/df["exp"]
print(df.head(6))
yconnect = create_engine('mysql+pymysql://root:3SYz54LS9#^9sBvC@172.16.40.158:4000/jerry_test?charset=utf8')
pd.io.sql.to_sql(df, "diary_ctr_new", yconnect, schema='jerry_test', if_exists='append', index=False)
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