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

add update_queue_numbers

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