Commit b100f3c9 authored by 王志伟's avatar 王志伟

send_email

parent b3cb69d6
......@@ -53,6 +53,20 @@ def DATA_fixed(x,y,z,q):
where stat_date >='2018-11-17' and stat_date<='2018-11-26' group by stat_date".format(x,y,z,q)
CVR_DATA_fixed = con_sql(sql_cid)
return CVR_DATA_fixed
def DATA_recently_all(x,y,z,q,m,t):
ten_days = get_somedate()
sql_cid = "select ({0}+{1})/{2} as {3} from {4} \
where stat_date >='{5}' ".format(x,y,z,q,m,t)
CVR_DATA_recently = con_sql(sql_cid)
return CVR_DATA_recently
#
# #获取固定时间的10天的数据
def DATA_fixed_all(x,y,z,q,m):
sql_cid = "select ({0}+{1})/{2} as {3} from {4} \
where stat_date >='2018-11-17' and stat_date<='2018-11-26' group by stat_date".format(x,y,z,q,m)
CVR_DATA_fixed = con_sql(sql_cid)
return CVR_DATA_fixed
#
# #新用户cvr
x_crv_new_temp=DATA_recently("diary_meigou_newUser","diary_clk_newUser","CVR_new","diary_meigou_crv",ten_days)
......@@ -92,15 +106,15 @@ y_ctr_old_temp=DATA_fixed("clk_count_oldUser_all","imp_count_oldUser_all","ctr_o
y_ctr_old=[float(str(Decimal(y_ctr_old_temp[i][0]).quantize(Decimal('0.0000')))) for i in range(len(y_ctr_old_temp))]
#
# #新用户ctr(on_click_diary_card)
x_ctr_new_o_temp=DATA_recently("clk_count_newUser_all_a","imp_count_newUser_all","ctr_new","on_click_diary_card",ten_days)
x_ctr_new_o_temp=DATA_recently_all("clk_count_newUser_all_a","clk_count_newUser_all_b","imp_count_newUser_all","ctr_new","on_click_diary_card",ten_days)
x_ctr_new_o=[float(str(Decimal(x_ctr_new_o_temp[i][0]).quantize(Decimal('0.0000')))) for i in range(len(x_ctr_new_o_temp))]
y_ctr_new_o_temp=DATA_fixed("clk_count_newUser_all_a","imp_count_newUser_all","ctr_new","on_click_diary_card")
y_ctr_new_o_temp=DATA_fixed_all("clk_count_newUser_all_a","clk_count_newUser_all_b","imp_count_newUser_all","ctr_new","on_click_diary_card")
y_ctr_new_o=[float(str(Decimal(y_ctr_new_o_temp[i][0]).quantize(Decimal('0.0000')))) for i in range(len(y_ctr_new_o_temp))]
#
# #老用户ctr(on_click_diary_card)
x_ctr_old_o_temp=DATA_recently("clk_count_oldUser_all_a","imp_count_oldUser_all","ctr_old","on_click_diary_card",ten_days)
x_ctr_old_o_temp=DATA_recently_all("clk_count_oldUser_all_a","clk_count_oldUser_all_b","imp_count_oldUser_all","ctr_old","on_click_diary_card",ten_days)
x_ctr_old_o=[float(str(Decimal(x_ctr_old_o_temp[i][0]).quantize(Decimal('0.0000')))) for i in range(len(x_ctr_old_o_temp))]
y_ctr_old_o_temp=DATA_fixed("clk_count_oldUser_all_a","imp_count_oldUser_all","ctr_old","on_click_diary_card")
y_ctr_old_o_temp=DATA_fixed_all("clk_count_oldUser_all_a","clk_count_oldUser_all_b","imp_count_oldUser_all","ctr_old","on_click_diary_card")
y_ctr_old_o=[float(str(Decimal(y_ctr_old_o_temp[i][0]).quantize(Decimal('0.0000')))) for i in range(len(y_ctr_old_o_temp))]
# #
#
......@@ -158,10 +172,10 @@ print("【6】老用户CTR假设检验结果:")
ctr_old_ttest=t_test(x_ctr_old,y_ctr_old)
#新用户ctr(on_click_diary_card)假设检验
print("【7】新用户CTR假设检验(on_click_diary_card)结果:")
print("【7】新用户CTR假设检验(日记本列表ctr)(on_click_diary_card)结果:")
ctr_new_o_ttest=t_test(x_ctr_new_o,y_ctr_new_o)
#老用户ctr(on_click_diary_card)假设检验
print("【8】老用户CTR假设检验(on_click_diary_card)结果:")
print("【8】老用户CTR假设检验(日记本列表ctr)(on_click_diary_card)结果:")
ctr_old_o_ttest=t_test(x_ctr_old_o,y_ctr_old_o)
#
# ###############推荐策略不变的情况下数据假设检验##############
......
......@@ -10,8 +10,8 @@ import datetime
from email.mime.multipart import MIMEMultipart
my_sender='gaoyazhe@igengmei.com'
my_pass = 'VCrKTui99a7ALhiK'
my_sender='wangzhiwei@igengmei.com'
my_pass = 'RiKEcsHAgesCZ7yd'
my_user1='wangzhiwei@igengmei.com'
def mail():
ret = True
......@@ -20,7 +20,7 @@ def mail():
pdfApart.add_header('Content-Disposition', 'attachment', filename=pdfFile)
m = MIMEMultipart()
m.attach(pdfApart)
m['Subject'] = 'title'
m['Subject'] = '数据指标监控数据(假设检验)'
try:
......
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