Commit 42c6fb7d authored by 张彦钊's avatar 张彦钊

update dairyQueueUpdate file

parent 39d71b30
...@@ -248,10 +248,7 @@ def user_update(device_id,city_id,data_set_cid): ...@@ -248,10 +248,7 @@ def user_update(device_id,city_id,data_set_cid):
def run(): def run():
data_set_cid = pd.read_csv(DIRECTORY_PATH + "data_set_cid.csv")["cid"].values.tolist() data_set_cid = pd.read_csv(DIRECTORY_PATH + "data_set_cid.csv")["cid"].values.tolist()
# TODO 如果测刘潇的没问题,去掉下面代码的注释 device_city_list = get_active_users()
# device_city_list = get_active_users()
# TODO 先测一下高雅喆的,如果没问题,然后再测刘潇的
device_city_list = (("358035085192742", "beijing"),)
# TODO 测试通过后加上计时 # TODO 测试通过后加上计时
start = time.time() start = time.time()
for device_city in device_city_list: for device_city in device_city_list:
......
...@@ -11,7 +11,7 @@ def get_active_users(): ...@@ -11,7 +11,7 @@ def get_active_users():
now = datetime.now() now = datetime.now()
now_start = str(now)[:16] + ":00" now_start = str(now)[:16] + ":00"
now_end = str(now)[:16] + ":59" now_end = str(now)[:16] + ":59"
sql = "select device_id,city_id from user_active_time limit 1;" sql = "select device_id,city_id from user_active_time limit 10;"
# TODO 正式上线后用下面的sql语句 # TODO 正式上线后用下面的sql语句
# sql = "select device_id,city_id from user_active_time " \ # sql = "select device_id,city_id from user_active_time " \
# "where active_time <= '{}' and active_time >= '{}'".format(now_end,now_start) # "where active_time <= '{}' and active_time >= '{}'".format(now_end,now_start)
...@@ -37,10 +37,17 @@ def get_active_users(): ...@@ -37,10 +37,17 @@ def get_active_users():
device_temp_list = df["device_id"].values.tolist() device_temp_list = df["device_id"].values.tolist()
predict_list = list(filter(lambda x: str(x)[-1] == "6", device_temp_list)) predict_list = list(filter(lambda x: str(x)[-1] == "6", device_temp_list))
df = df.loc[df["device_id"].isin(predict_list)] df = df.loc[df["device_id"].isin(predict_list)]
# TODO 上线后把下面的temp删掉
# 把刘潇和雅喆的id加进去
temp = pd.DataFrame({"device_id":["AB20292B-5D15-4C44-9429-1C2FF5ED26F6","358035085192742"],
"city_id":["beijing","beijing"]})
df = df.append(temp)
if df.empty: if df.empty:
print("没有尾号是6的用户,不需要预测") print("没有尾号是6的用户,不需要预测")
else: else:
device_list = df["device_id"].values.tolist() device_list = df["device_id"].values.tolist()
print("358035085192742" in device_list)
print("AB20292B-5D15-4C44-9429-1C2FF5ED26F6" in device_list)
city_list = df["city_id"].values.tolist() city_list = df["city_id"].values.tolist()
device_city_list = list(zip(device_list, city_list)) device_city_list = list(zip(device_list, city_list))
......
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