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
08cd43e0
Commit
08cd43e0
authored
May 15, 2020
by
赵威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'offic' into 'master'
Offic See merge request
!58
parents
adf38dfe
9adcba50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+5
-1
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
08cd43e0
...
...
@@ -5,6 +5,7 @@ import operator
from
collections
import
Counter
import
redis
from
pyspark
import
SparkConf
from
pyspark.sql
import
SparkSession
from
tool
import
(
get_jerry_test
,
get_tag3_user_log
,
send_email
,
write_user_portrait
)
...
...
@@ -13,7 +14,8 @@ from tool import (get_jerry_test, get_tag3_user_log, send_email, write_user_port
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}]
# {'手术': 5.8475846946146195, '激光': 1.949194898204873}
def
merge_values
(
list_of_dict
):
return
dict
(
functools
.
reduce
(
operator
.
add
,
map
(
Counter
,
list_of_dict
)))
d
=
dict
(
functools
.
reduce
(
operator
.
add
,
map
(
Counter
,
list_of_dict
)))
return
dict
(
sorted
(
d
.
items
(),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
))
# [("a", 1), ("b", 2)]
...
...
@@ -110,6 +112,8 @@ def consume_kafka():
db
.
close
()
cursor
.
close
()
# device_ids_lst = ["androidid_a25a1129c0b38f7b"]
sparkConf
=
SparkConf
()
.
set
(
"spark.hive.mapred.supports.subdirectories"
,
"true"
)
\
.
set
(
"spark.hadoop.mapreduce.input.fileinputformat.input.dir.recursive"
,
"true"
)
\
.
set
(
"spark.tispark.plan.allow_index_double_read"
,
"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