Commit 96c0590d authored by 张彦钊's avatar 张彦钊

add

parent ac22ea27
......@@ -11,8 +11,13 @@ param_dict={}
# param_detail = {"device_id": 'xx',"size": 10,"offset":0, "query": "双眼皮","user_city_tag_id": 328,
# "is_officer":False,"filters":{}}
param_dict["method"]="doris/search/bangdan"
param_detail = {"device_id": '2',"size": 10,"offset":0, "user_city_tag_id": -1,"is_officer":False,"unit_ids":[]}
# param_dict["method"]="doris/search/bangdan"
# param_detail = {"device_id": '2',"size": 10,"offset":0, "user_city_tag_id": -1,"is_officer":False,"unit_ids":[]}
diary_list = [9462756,9462737,9462730,9462719]
param_dict["method"]="doris/search/diary_score"
param_detail = {"diary_list": diary_list}
# a = [105, 2941, 780, 102, 873, 2060, 187, 2935, 2108, 912, 928, 2059, 4437, 822, 2866, 2778, 824, 821, 2938]
......
......@@ -16,7 +16,6 @@ def hospital():
"left join statistic_merchant_rank_factor m on b.merchant_id = m.merchant_id " \
"where api.doctor_type = 1 and h.date = '{}' and m.partition_date = '{}';".format(date_str,date_str)
db = pymysql.connect(host='172.16.30.141', port=3306, user='work', passwd='BJQaT9VzDcuPBqkd', db='zhengxing')
cursor = db.cursor()
cursor.execute(sql)
......@@ -50,12 +49,12 @@ def hospital():
df.loc[df["doctor_discount_30_days"] < 0, ["doctor_discount_30_days"]] = 0
df.loc[df["expand_rechange_amount_30"] < 0, ["expand_rechange_amount_30"]] = 0
df.loc[df["tmp"] <= 1500, ["tmp"]] = 1500
df.loc[df["tmp"] <= 3000, ["tmp"]] = 3000
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
df.loc[df["all_exposure"] <= 3000, ["ctr"]] = 0.01
df.loc[df["ctr"] < 0.01, ["ctr"]] = 0.01
df.loc[df["ctr"] > 0.2, ["ctr"]] = 0.2
df.loc[df["cpt"] > 10, ["cpt"]] = 10
......@@ -75,7 +74,7 @@ def hospital():
data = data.drop_duplicates()
print(data.shape)
data.to_csv('/tmp/25_hospital.csv',index=False)
data.to_csv('/tmp/26_hospital.csv',index=False)
def new_doctor():
......@@ -112,7 +111,7 @@ def new_doctor():
print("all_exposure")
print(df.shape)
df["tmp"] = df["service_pv_30"] + df["mexpert_pv_30"] +df["organization_pv_30"]
df.loc[df["tmp"] <= 1500, ["tmp"]] = 1500
df.loc[df["tmp"] <= 3000, ["tmp"]] = 3000
df["ctr"] = df["service_exposure_pv_30"] / df["all_exposure"] * df["service_ctr_30"] + \
df["expert_exposure_pv_30"]/df["all_exposure"] * (df["expert_pv_30"] / df["expert_exposure_pv_30"])
......@@ -123,7 +122,7 @@ def new_doctor():
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
df.loc[df["all_exposure"] <= 3000, ["ctr"]] = 0.01
df.loc[df["ctr"] < 0.01, ["ctr"]] = 0.01
df.loc[df["ctr"] > 0.2, ["ctr"]] = 0.2
df.loc[df["commission"] > 10, ["commission"]] = 10
......@@ -142,15 +141,11 @@ def new_doctor():
data = data.drop_duplicates()
print(data.shape)
data.to_csv('/tmp/25_doctor.csv',index=False)
data.to_csv('/tmp/26_doctor.csv',index=False)
print("doctor end")
if __name__ == "__main__":
# doctor()
# hospital()
# old()
new_doctor()
hospital()
......
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