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
48cdc7e5
Commit
48cdc7e5
authored
Mar 04, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add merge value
parent
aff23a4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
19 deletions
+41
-19
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+41
-19
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
48cdc7e5
import
functools
import
operator
from
collections
import
Counter
from
tool
import
get_tag3_user_log
def
merge_values
(
d1
,
d2
):
ini_dict
=
[
d1
,
d2
]
return
dict
(
functools
.
reduce
(
operator
.
add
,
map
(
Counter
,
ini_dict
)))
def
update_tag3_user_portrait
(
cl_id
):
user_df
=
get_tag3_user_log
(
cl_id
)
if
not
user_df
.
empty
:
user_df
[
"first_solutions"
]
=
list
(
zip
(
user_df
[
"first_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_solutions"
]
=
list
(
zip
(
user_df
[
"second_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"first_demands"
]
=
list
(
zip
(
user_df
[
"first_demands"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_demands"
]
=
list
(
zip
(
user_df
[
"second_demands"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"first_positions"
]
=
list
(
zip
(
user_df
[
"first_positions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_positions"
]
=
list
(
zip
(
user_df
[
"second_positions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"first_solutions"
]
=
list
(
zip
(
user_df
[
"first_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_solutions"
]
=
list
(
zip
(
user_df
[
"second_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"first_demands"
]
=
list
(
zip
(
user_df
[
"first_demands"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_demands"
]
=
list
(
zip
(
user_df
[
"second_demands"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"first_positions"
]
=
list
(
zip
(
user_df
[
"first_positions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_positions"
]
=
list
(
zip
(
user_df
[
"second_positions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"projects"
]
=
list
(
zip
(
user_df
[
"projects"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"first_solutions_dict"
]
=
user_df
[
"first_solutions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"second_solutions_dict"
]
=
user_df
[
"second_solutions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"first_demands_dict"
]
=
user_df
[
"first_demands"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"second_demands_dict"
]
=
user_df
[
"second_demands"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"first_positions_dict"
]
=
user_df
[
"first_positions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"second_positions_dict"
]
=
user_df
[
"second_positions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"first_solutions_dict"
]
=
user_df
[
"first_solutions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"second_solutions_dict"
]
=
user_df
[
"second_solutions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"first_demands_dict"
]
=
user_df
[
"first_demands"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"second_demands_dict"
]
=
user_df
[
"second_demands"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"first_positions_dict"
]
=
user_df
[
"first_positions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"second_positions_dict"
]
=
user_df
[
"second_positions"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
user_df
[
"projects_dict"
]
=
user_df
[
"projects"
]
.
apply
(
lambda
x
:
dict
(
zip
(
x
[
0
],
[
x
[
1
]]
*
len
(
x
[
0
]))))
first_solutions_list
=
user_df
[
"first_solutions_dict"
]
.
tolist
()
second_solutions_list
=
user_df
[
"second_solutions_dict"
]
.
tolist
()
first_demands_list
=
user_df
[
"first_demands_
lis
t"
]
.
tolist
()
first_demands_list
=
user_df
[
"first_demands_
dic
t"
]
.
tolist
()
second_demands_list
=
user_df
[
"second_demands_dict"
]
.
tolist
()
first_positions_list
=
user_df
[
"first_positions_dict"
]
.
tolist
()
second_positions_list
=
user_df
[
"second_positions_dict"
]
.
tolist
()
projects_list
=
user_df
[
"projects_dict"
]
.
tolist
()
print
(
first_solutions_list
)
print
(
second_solutions_list
)
print
(
first_demands_list
)
print
(
second_demands_list
)
print
(
first_positions_list
)
print
(
second_positions_list
)
print
(
projects_list
)
print
(
merge_values
(
first_solutions_list
),
"
\n
"
)
print
(
second_solutions_list
,
"
\n
"
)
print
(
merge_values
(
second_solutions_list
))
print
(
first_demands_list
,
"
\n
"
)
print
(
merge_values
(
first_demands_list
))
if
__name__
==
"__main__"
:
...
...
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