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

增加排序

parent 5b1854e8
......@@ -34,23 +34,19 @@ def ctr_all():
cursor.execute(sql_active)
result = cursor.fetchall()
tail56 = pd.DataFrame(list(result))[0].values.tolist()
print("当天尾号5或6活跃用户总数:")
print(len(tail56))
cover = list(set(tail56)&set(device_id))
id = list()
cid = list()
number = list()
for i in cover[0:10]:
for i in cover:
sql = "select count(cid) from data_feed_exposure " \
"where cid_type = 'diary'" \
"and stat_date = '{}' and device_id = '{}';".format(date,i)
cursor.execute(sql)
result = cursor.fetchone()[0]
id.append(i)
cid.append(i)
number.append(result)
df = pd.DataFrame()
df['id'] = id
df['id'] = cid
df['number'] = number
df = df.sort_values(by = "number",ascending=False)
df.to_csv(DIRECTORY_PATH+"exp.csv",index=None)
......
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