Commit 642f63bf authored by 张彦钊's avatar 张彦钊

add

parent 81943df7
......@@ -4,8 +4,10 @@ import pandas as pd
def doctor():
date_str = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y%m%d")
date_tmp = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y-%m-%d")
date_str = "20200101"
date_tmp = "2020-01-01"
# date_str = (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," \
"b.merchant_id,budan.budan_payment_30_days " \
......@@ -56,10 +58,10 @@ def doctor():
df["expert_exposure_pv_30"]/df["all_exposure"] * (df["expert_pv_30"] / df["expert_exposure_pv_30"])
df.loc[df["doctor_discount_30_days"] < 0, ["doctor_discount_30_days"]] = 0
df.loc[df["budan_payment_30_days"] < 0, ["budan_payment_30_days"]] = 0
# df.loc[df["budan_payment_30_days"] < 0, ["budan_payment_30_days"]] = 0
df.loc[df["expand_rechange_amount_30"] < 0, ["expand_rechange_amount_30"]] = 0
df["commission"] = (df["doctor_discount_30_days"] + df["budan_payment_30_days"])/df["tmp"]
df["commission"] = df["doctor_discount_30_days"]/df["tmp"]
df["pv_ad"] = df["expand_rechange_amount_30"]/df["tmp"]
df.loc[df["all_exposure"] <= 1500, ["ctr"]] = 0.01
......@@ -79,13 +81,15 @@ def doctor():
data = df.loc[:, columns]
data = data.drop_duplicates()
data.to_csv('/tmp/6_doctor.csv',index=False)
data.to_csv('/tmp/1_doctor.csv',index=False)
print("doctor end")
def hospital():
date_str = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y%m%d")
date_tmp = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y-%m-%d")
date_str = "20200101"
date_tmp = "2020-01-01"
# date_str = (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 api.id," \
"h.hospital_id,h.hospital_exposure_pv_30,h.service_exposure_pv_30,h.expert_exposure_pv_30," \
......@@ -142,10 +146,10 @@ def hospital():
df["expert_exposure_pv_30"]/df["all_exposure"] * df["expert_ctr_30"]
df.loc[df["doctor_discount_30_days"] < 0, ["doctor_discount_30_days"]] = 0
df.loc[df["budan_payment_30_days"] < 0, ["budan_payment_30_days"]] = 0
# df.loc[df["budan_payment_30_days"] < 0, ["budan_payment_30_days"]] = 0
df.loc[df["expand_rechange_amount_30"] < 0, ["expand_rechange_amount_30"]] = 0
df["commission"] = (df["doctor_discount_30_days"] + df["budan_payment_30_days"])/df["tmp"]
df["commission"] = df["doctor_discount_30_days"]/df["tmp"]
df["cpt"] = df["expand_rechange_amount_30"]/df["tmp"]
df.loc[df["all_exposure"] <= 1500, ["ctr"]] = 0.01
......@@ -168,7 +172,7 @@ def hospital():
data = data.drop_duplicates()
print(data.head(6))
data.to_csv('/tmp/6_hospital.csv',index=False)
data.to_csv('/tmp/1_hospital.csv',index=False)
if __name__ == "__main__":
......
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