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

add

parent 642f63bf
...@@ -10,11 +10,10 @@ def doctor(): ...@@ -10,11 +10,10 @@ def doctor():
# date_tmp = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y-%m-%d") # date_tmp = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y-%m-%d")
sql = "select d.doctor_id,d.service_exposure_pv_30,d.service_ctr_30,d.expert_exposure_pv_30,d.expert_pv_30," \ sql = "select d.doctor_id,d.service_exposure_pv_30,d.service_ctr_30,d.expert_exposure_pv_30,d.expert_pv_30," \
"b.merchant_id,budan.budan_payment_30_days " \ "b.merchant_id " \
"from statistic_doctor_rank_factor d " \ "from statistic_doctor_rank_factor d " \
"left join hippo_merchantrelevance b on d.doctor_id = b.doctor_id " \ "left join hippo_merchantrelevance b on d.doctor_id = b.doctor_id " \
"left join al_meigou_service_smart_rank_budan_payment budan on b.merchant_id = budan.merchant_id " \ "where d.partition_date = '{}';".format(date_str)
"where d.partition_date = '{}' and budan.stat_date = '{}';".format(date_str, date_tmp)
db = pymysql.connect(host='172.16.30.143', port=3306, user='work', passwd='BJQaT9VzDcuPBqkd', db='zhengxing') db = pymysql.connect(host='172.16.30.143', port=3306, user='work', passwd='BJQaT9VzDcuPBqkd', db='zhengxing')
cursor = db.cursor() cursor = db.cursor()
...@@ -22,7 +21,7 @@ def doctor(): ...@@ -22,7 +21,7 @@ def doctor():
result = cursor.fetchall() result = cursor.fetchall()
df = pd.DataFrame(list(result)) df = pd.DataFrame(list(result))
name = ["doctor_id", "service_exposure_pv_30", "service_ctr_30", "expert_exposure_pv_30", "expert_pv_30", name = ["doctor_id", "service_exposure_pv_30", "service_ctr_30", "expert_exposure_pv_30", "expert_pv_30",
"merchant_id","budan_payment_30_days"] "merchant_id"]
df = df.rename(columns=dict(zip(list(range(len(name))), name))) df = df.rename(columns=dict(zip(list(range(len(name))), name)))
...@@ -45,7 +44,7 @@ def doctor(): ...@@ -45,7 +44,7 @@ def doctor():
for i in ["service_exposure_pv_30", "service_ctr_30", "expert_exposure_pv_30", "expert_pv_30", for i in ["service_exposure_pv_30", "service_ctr_30", "expert_exposure_pv_30", "expert_pv_30",
"doctor_discount_30_days", "expand_rechange_amount_30", "service_pv_30", "doctor_discount_30_days", "expand_rechange_amount_30", "service_pv_30",
"mexpert_pv_30", "organization_pv_30", "budan_payment_30_days"]: "mexpert_pv_30", "organization_pv_30"]:
df[i] = df[i].astype("float") df[i] = df[i].astype("float")
df["all_exposure"] = df["service_exposure_pv_30"] + df["expert_exposure_pv_30"] df["all_exposure"] = df["service_exposure_pv_30"] + df["expert_exposure_pv_30"]
...@@ -77,7 +76,7 @@ def doctor(): ...@@ -77,7 +76,7 @@ def doctor():
columns = ["doctor_id","score","ctr","commission","pv_ad","service_exposure_pv_30", columns = ["doctor_id","score","ctr","commission","pv_ad","service_exposure_pv_30",
"service_ctr_30","expert_exposure_pv_30","expert_pv_30", "service_ctr_30","expert_exposure_pv_30","expert_pv_30",
"merchant_id","doctor_discount_30_days","expand_rechange_amount_30","service_pv_30", "merchant_id","doctor_discount_30_days","expand_rechange_amount_30","service_pv_30",
"mexpert_pv_30","organization_pv_30","budan_payment_30_days"] "mexpert_pv_30","organization_pv_30"]
data = df.loc[:, columns] data = df.loc[:, columns]
data = data.drop_duplicates() data = data.drop_duplicates()
......
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