Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
650e2992
Commit
650e2992
authored
Aug 25, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update dairyQueueUpdate file
parent
e5abdf9b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
19 deletions
+15
-19
diaryQueueUpdate.py
diaryQueueUpdate.py
+4
-3
userProfile.py
userProfile.py
+11
-16
No files found.
diaryQueueUpdate.py
View file @
650e2992
...
...
@@ -249,11 +249,12 @@ def user_update(device_id,city_id,data_set_cid):
def
run
():
data_set_cid
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"data_set_cid.csv"
)[
"cid"
]
.
values
.
tolist
()
device_city_list
=
get_active_users
()
# TODO 测试通过后加上计时
start
=
time
.
time
()
for
device_city
in
device_city_list
:
start
=
time
.
time
()
user_update
(
device_city
[
0
],
device_city
[
1
],
data_set_cid
)
end
=
time
.
time
()
end
=
time
.
time
()
print
(
"更新该用户队列耗时{}秒"
.
format
((
end
-
start
)))
print
(
"end"
)
...
...
userProfile.py
View file @
650e2992
...
...
@@ -31,23 +31,18 @@ def get_active_users():
print
(
"该列表是新用户,不需要预测"
)
else
:
# TODO 正式上线后注释下面的只预测尾号是6的代码
# 只预测尾号是6的ID,这块是测试要求的
,这块也可以在数据库取数据时过滤一下
device_temp_list
=
df
[
"device_id"
]
.
values
.
tolist
()
predict_list
=
list
(
filter
(
lambda
x
:
str
(
x
)[
-
1
]
==
"6"
,
device_temp_list
))
df
=
df
.
loc
[
df
[
"device_id"
]
.
isin
(
predict_list
)]
# 只预测尾号是6的ID,这块是测试要求的
#
device_temp_list = df["device_id"].values.tolist()
#
predict_list = list(filter(lambda x: str(x)[-1] == "6", device_temp_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
:
print
(
"没有尾号是6的用户,不需要预测"
)
else
:
device_list
=
df
[
"device_id"
]
.
values
.
tolist
()
city_list
=
df
[
"city_id"
]
.
values
.
tolist
()
device_city_list
=
list
(
zip
(
device_list
,
city_list
))
return
device_city_list
# 把刘潇的id加进去
df
=
pd
.
DataFrame
({
"device_id"
:[
"358035085192742"
],
"city_id"
:[
"beijing"
]})
device_list
=
df
[
"device_id"
]
.
values
.
tolist
()
city_list
=
df
[
"city_id"
]
.
values
.
tolist
()
device_city_list
=
list
(
zip
(
device_list
,
city_list
))
print
(
"当下这一分钟预测用户数量:{}"
.
format
(
len
(
device_city_list
)))
return
device_city_list
def
fetch_user_profile
(
device_id
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment