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
42c6fb7d
Commit
42c6fb7d
authored
Aug 25, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update dairyQueueUpdate file
parent
39d71b30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
diaryQueueUpdate.py
diaryQueueUpdate.py
+1
-4
userProfile.py
userProfile.py
+8
-1
No files found.
diaryQueueUpdate.py
View file @
42c6fb7d
...
@@ -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
:
...
...
userProfile.py
View file @
42c6fb7d
...
@@ -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 1
0
;"
# 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
))
...
...
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