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
55a957a7
Commit
55a957a7
authored
Aug 08, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change sql
parent
5b296bc4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
.DS_Store
.DS_Store
+0
-0
diaryCandidateSet.py
diaryCandidateSet.py
+5
-4
predictDiary.py
predictDiary.py
+1
-1
No files found.
.DS_Store
View file @
55a957a7
No preview for this file type
diaryCandidateSet.py
View file @
55a957a7
...
@@ -18,7 +18,9 @@ def filter_cid(df):
...
@@ -18,7 +18,9 @@ def filter_cid(df):
def
get_allCitiesDiaryTop2000
():
def
get_allCitiesDiaryTop2000
():
# 获取全国点击量TOP2000日记
# 获取全国点击量TOP2000日记
sql
=
"select city_id,cid from data_feed_click where cid_type = 'diary' order by click_count_choice desc limit 2000"
sql
=
"select city_id,cid from data_feed_click "
\
"where cid_type = 'diary' group by cid order by max(click_count_choice) desc limit 2000"
allCitiesTop2000
=
con_sql
(
sql
)
allCitiesTop2000
=
con_sql
(
sql
)
allCitiesTop2000
=
allCitiesTop2000
.
rename
(
columns
=
{
0
:
"city_id"
,
1
:
"cid"
})
allCitiesTop2000
=
allCitiesTop2000
.
rename
(
columns
=
{
0
:
"city_id"
,
1
:
"cid"
})
allCitiesTop2000
=
filter_cid
(
allCitiesTop2000
)
allCitiesTop2000
=
filter_cid
(
allCitiesTop2000
)
...
@@ -43,9 +45,8 @@ def get_eachCityDiaryTop2000():
...
@@ -43,9 +45,8 @@ def get_eachCityDiaryTop2000():
cityList
=
get_cityList
()
cityList
=
get_cityList
()
allCitiesTop2000
=
get_allCitiesDiaryTop2000
()
allCitiesTop2000
=
get_allCitiesDiaryTop2000
()
for
i
in
cityList
:
for
i
in
cityList
:
sql
=
"select city_id,cid from data_feed_click "
\
sql
=
"select '{0}',cid from data_feed_click "
\
"where cid_type = 'diary' and city_id = '{0}' "
\
"where cid_type = 'diary' group by cid order by max(click_count_choice) desc limit 2000"
.
format
(
i
)
"order by click_count_choice desc limit 2000"
.
format
(
i
)
data
=
con_sql
(
sql
)
data
=
con_sql
(
sql
)
data
=
data
.
rename
(
columns
=
{
0
:
"city_id"
,
1
:
"cid"
})
data
=
data
.
rename
(
columns
=
{
0
:
"city_id"
,
1
:
"cid"
})
data
=
filter_cid
(
data
)
data
=
filter_cid
(
data
)
...
...
predictDiary.py
View file @
55a957a7
...
@@ -72,7 +72,7 @@ def upload_predict(user_profile, instance):
...
@@ -72,7 +72,7 @@ def upload_predict(user_profile, instance):
def
wrapper_result
(
prob
,
device_id
):
def
wrapper_result
(
prob
,
device_id
):
prob
=
prob
.
head
(
500
)
prob
=
prob
.
head
(
500
)
prob
.
loc
[:,
"url"
]
=
prob
[
"cid"
]
.
apply
(
lambda
x
:
"http://m.igengmei.com/diary_book/"
+
str
(
x
)
+
'/'
)
prob
.
loc
[:,
"url"
]
=
prob
[
"cid"
]
.
apply
(
lambda
x
:
"http://m.igengmei.com/diary_book/"
+
str
(
x
[
6
:]
)
+
'/'
)
prob
.
to_csv
(
DIRECTORY_PATH
+
"result/{}_feed"
.
format
(
device_id
),
index
=
False
)
prob
.
to_csv
(
DIRECTORY_PATH
+
"result/{}_feed"
.
format
(
device_id
),
index
=
False
)
...
...
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