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
d0a857c9
Commit
d0a857c9
authored
Aug 16, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add notes for test
parent
c6881729
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
25 deletions
+25
-25
diaryCandidateSet.py
diaryCandidateSet.py
+25
-25
No files found.
diaryCandidateSet.py
View file @
d0a857c9
...
@@ -52,35 +52,35 @@ def pool_method(i,sql,allCitiesTop3000):
...
@@ -52,35 +52,35 @@ def pool_method(i,sql,allCitiesTop3000):
# 把城市列表切分成n份,然后拼接成一个列表
# 把城市列表切分成n份,然后拼接成一个列表
def
split_cityList
(
cityList
,
n
):
#
def split_cityList(cityList,n):
l
=
len
(
cityList
)
#
l = len(cityList)
step
=
np
.
rint
(
l
/
n
)
#
step = np.rint(l/n)
new_list
=
[]
#
new_list = []
x
=
0
#
x = 0
while
True
:
#
while True:
if
x
+
step
<
:
#
if x + step < :
data_list
.
append
(
data
.
iloc
[
x
:
x
+
step
])
#
data_list.append(data.iloc[x:x + step])
x
=
x
+
step
+
1
#
x = x + step + 1
else
:
#
else:
data_list
.
append
(
data
.
iloc
[
x
:
data
.
__len__
()])
#
data_list.append(data.iloc[x:data.__len__()])
break
#
break
# 多线程方法获取全国城市热门日记
# 多线程方法获取全国城市热门日记
def
multi_get_eachCityDiaryTop3000
(
processes
):
#
def multi_get_eachCityDiaryTop3000(processes):
cityList
=
get_cityList
()
#
cityList = get_cityList()
allCitiesTop3000
=
get_allCitiesDiaryTop3000
()
#
allCitiesTop3000 = get_allCitiesDiaryTop3000()
#
pool
=
Pool
(
processes
)
#
pool = Pool(processes)
for
i
in
range
(
len
(
data_list
)):
#
for i in range(len(data_list)):
data_list
[
i
]
=
pool
.
apply_async
(
self
.
pool_function
,
(
data_list
[
i
],
t
,))
#
data_list[i] = pool.apply_async(self.pool_function, (data_list[i], t,))
#
result_map
=
{}
#
result_map = {}
for
i
in
data_list
:
#
for i in data_list:
result_map
.
update
(
i
.
get
())
#
result_map.update(i.get())
pool
.
close
()
#
pool.close()
pool
.
join
()
#
pool.join()
def
get_eachCityDiaryTop3000
():
def
get_eachCityDiaryTop3000
():
...
...
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