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

add update_queue_numbers

parent 6b3bb201
...@@ -50,13 +50,13 @@ data = click.append(exposure) ...@@ -50,13 +50,13 @@ data = click.append(exposure)
print("done 合并点击表和曝光表") print("done 合并点击表和曝光表")
print(data.head(2)) print(data.head(2))
# 从time特征中抽取hour、weekday # 从time特征中抽取hour、weekday
# data["hour"] = data["time"].apply(lambda x:datetime.datetime.fromtimestamp(x).hour) data["hour"] = data["time"].apply(lambda x:datetime.datetime.fromtimestamp(x).hour)
# data["weekday"] = data["time"].apply(lambda x:datetime.datetime.fromtimestamp(x).weekday()) data["weekday"] = data["time"].apply(lambda x:datetime.datetime.fromtimestamp(x).weekday())
# 数值是0的特征会被ffm格式删除,经过下面的处理后,没有数值是0的特征 # 数值是0的特征会被ffm格式删除,经过下面的处理后,没有数值是0的特征
# data.loc[data["hour"]==0] = 24 data.loc[data["hour"]==0] = 24
# data.loc[data["weekday"]==0] = 7 data.loc[data["weekday"]==0] = 7
# data["hour"] = data["hour"].astype("category") data["hour"] = data["hour"].astype("category")
# data["weekday"] = data["weekday"].astype("category") data["weekday"] = data["weekday"].astype("category")
data = data.drop("time",axis=1) data = data.drop("time",axis=1)
print("成功从time特征中抽取hour、weekday") print("成功从time特征中抽取hour、weekday")
print(data.head(2)) print(data.head(2))
......
...@@ -171,7 +171,9 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id): ...@@ -171,7 +171,9 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
cursor.execute(sql) cursor.execute(sql)
db.commit() db.commit()
db.close() db.close()
print("成功写入diaryid") global update_queue_numbers
update_queue_numbers += 1
print("更新队列总个数:{}".format(update_queue_numbers))
def get_queue(device_id, city_id,queue_name): def get_queue(device_id, city_id,queue_name):
...@@ -244,6 +246,7 @@ if __name__ == "__main__": ...@@ -244,6 +246,7 @@ if __name__ == "__main__":
# 增加缓存日记视频列表 # 增加缓存日记视频列表
cache_video_id = [] cache_video_id = []
cache_device_city_list = [] cache_device_city_list = []
update_queue_numbers = 0
while True: while True:
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()
total_video_id = get_video_id(cache_video_id) total_video_id = get_video_id(cache_video_id)
......
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