Commit 0762305f authored by 张彦钊's avatar 张彦钊

增加apply参数

parent ffb90508
...@@ -155,7 +155,10 @@ def get_data(): ...@@ -155,7 +155,10 @@ def get_data():
df = df.rename(columns={0: "y", 1: "z", 2: "stat_date", 3: "ucity_id",4: "clevel1_id", 5: "ccity_name", df = df.rename(columns={0: "y", 1: "z", 2: "stat_date", 3: "ucity_id",4: "clevel1_id", 5: "ccity_name",
6:"device_type",7:"manufacturer",8:"channel",9:"top",10:"time",11:"cid_id"}) 6:"device_type",7:"manufacturer",8:"channel",9:"top",10:"time",11:"cid_id"})
print("esmm data ok") print("esmm data ok")
df["video"] = df["cid_id"].apply(video_judge) db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_prod')
sql = "select cid from diary_video"
diary_video = con_sql(db, sql)[0].values.tolist()
df["video"] = df["cid_id"].apply(video_judge,args=(diary_video,))
df = df.drop("cid_id",axis=1) df = df.drop("cid_id",axis=1)
print(df.head(2)) print(df.head(2))
...@@ -179,10 +182,7 @@ def get_data(): ...@@ -179,10 +182,7 @@ def get_data():
ucity_id = list(set(df["ucity_id"].values.tolist())) ucity_id = list(set(df["ucity_id"].values.tolist()))
return df,validate_date,ucity_id,ccity_name return df,validate_date,ucity_id,ccity_name
def video_judge(cid): def video_judge(cid,diary_video):
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_prod')
sql = "select cid from diary_video"
diary_video = con_sql(db, sql)[0].values.tolist()
if cid in diary_video: if cid in diary_video:
return "yes" return "yes"
else: else:
......
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