Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
meta_base_code
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黎涛
meta_base_code
Commits
8f9fd6f2
Commit
8f9fd6f2
authored
Sep 25, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
bee817f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
out_put_user_post_each_strategy.py
output/out_put_user_post_each_strategy.py
+27
-4
output_article_distribution_0917.py
output/output_article_distribution_0917.py
+0
-8
No files found.
output/out_put_user_post_each_strategy.py
View file @
8f9fd6f2
...
@@ -262,8 +262,7 @@ exposure_sql = """
...
@@ -262,8 +262,7 @@ exposure_sql = """
SELECT
SELECT
cl_id,
cl_id,
card_id,
card_id,
transaction_type,
transaction_type
count(distinct app_session_id) as session_pv
FROM
FROM
(
(
SELECT
SELECT
...
@@ -303,11 +302,17 @@ projects_demands_id_count = {}
...
@@ -303,11 +302,17 @@ projects_demands_id_count = {}
baoguang_dict
=
{}
baoguang_dict
=
{}
# 遍历card_id 找出对应的device_id是否在灰度里
# 遍历card_id 找出对应的device_id是否在灰度里
# 找出card_id 对应帖子的标签 并分类汇总 得到 标签-计数字段
# 找出card_id 对应帖子的标签 并分类汇总 得到 标签-计数字段
transaction_second_demands_dict
=
{}
transaction_projects_demands_type
=
{}
for
res
in
sql_res
:
for
res
in
sql_res
:
# partition_date = res.partition_date
# partition_date = res.partition_date
# print(res)
# print(res)
cl_id
=
res
.
cl_id
cl_id
=
res
.
cl_id
card_id
=
res
.
card_id
card_id
=
res
.
card_id
transaction_type
=
res
.
transaction_type
if
cl_id
in
device_id_dict
:
if
cl_id
in
device_id_dict
:
# print("has device")
# print("has device")
...
@@ -326,6 +331,15 @@ for res in sql_res:
...
@@ -326,6 +331,15 @@ for res in sql_res:
second_demands_id_count
[
tag_id
]
=
{}
second_demands_id_count
[
tag_id
]
=
{}
second_demands_id_count
[
tag_id
][
int
(
card_id
)]
=
1
second_demands_id_count
[
tag_id
][
int
(
card_id
)]
=
1
if
tag_id
in
transaction_second_demands_dict
:
try
:
transaction_second_demands_dict
[
tag_id
][
transaction_type
]
+=
1
except
:
transaction_second_demands_dict
[
tag_id
][
transaction_type
]
=
1
else
:
transaction_second_demands_dict
[
tag_id
]
=
{}
transaction_second_demands_dict
[
tag_id
][
transaction_type
]
=
1
# if tag_id in baoguang_dict:
# if tag_id in baoguang_dict:
# baoguang_dict[tag_id] += session_pv
# baoguang_dict[tag_id] += session_pv
# else:
# else:
...
@@ -341,6 +355,15 @@ for res in sql_res:
...
@@ -341,6 +355,15 @@ for res in sql_res:
projects_demands_id_count
[
tag_id
]
=
{}
projects_demands_id_count
[
tag_id
]
=
{}
projects_demands_id_count
[
tag_id
][
int
(
card_id
)]
=
1
projects_demands_id_count
[
tag_id
][
int
(
card_id
)]
=
1
if
tag_id
in
transaction_projects_demands_type
:
try
:
transaction_projects_demands_type
[
tag_id
][
transaction_type
]
+=
1
except
:
transaction_projects_demands_type
[
tag_id
][
transaction_type
]
=
1
else
:
transaction_projects_demands_type
[
tag_id
]
=
{}
transaction_projects_demands_type
[
tag_id
][
transaction_type
]
=
1
final_projects_list
=
[]
final_projects_list
=
[]
second_demands_list
=
[]
second_demands_list
=
[]
print
(
projects_demands_id_count
)
print
(
projects_demands_id_count
)
...
@@ -356,7 +379,7 @@ for tag_id in second_demands_tag_count:
...
@@ -356,7 +379,7 @@ for tag_id in second_demands_tag_count:
"exporsure_count"
:
len
(
second_demands_id_count
[
tag_id
])
if
second_demands_id_count
.
get
(
tag_id
)
else
0
,
"exporsure_count"
:
len
(
second_demands_id_count
[
tag_id
])
if
second_demands_id_count
.
get
(
tag_id
)
else
0
,
}
}
print
(
temp_dict
[
'tag_name'
],
temp_dict
[
'
device_count'
],
temp_dict
[
'tractate_count'
],
temp_dict
[
'exporsure_count'
])
print
(
temp_dict
[
'tag_name'
],
temp_dict
[
'
tractate_count'
],
temp_dict
[
'exporsure_count'
],
temp_dict
[
'device_count'
],
transaction_second_demands_dict
[
tag_id
])
# print(temp_dict)
# print(temp_dict)
# if temp_dict['tractate_count'] < temp_dict['exporsure_count']:
# if temp_dict['tractate_count'] < temp_dict['exporsure_count']:
# print("error" , second_demands_id_count[tag_id])
# print("error" , second_demands_id_count[tag_id])
...
@@ -384,7 +407,7 @@ for tag_id in projects_demands_tag_count:
...
@@ -384,7 +407,7 @@ for tag_id in projects_demands_tag_count:
# if temp_dict['tractate_count'] < temp_dict['exporsure_count']:
# if temp_dict['tractate_count'] < temp_dict['exporsure_count']:
# print("error" , projects_demands_id_count[tag_id])
# print("error" , projects_demands_id_count[tag_id])
print
(
temp_dict
[
'tag_name'
],
temp_dict
[
'
device_count'
],
temp_dict
[
'tractate_count'
],
temp_dict
[
'exporsure_count'
])
print
(
temp_dict
[
'tag_name'
],
temp_dict
[
'
tractate_count'
],
temp_dict
[
'exporsure_count'
],
temp_dict
[
'device_count'
],
transaction_projects_demands_type
[
tag_id
])
# print(2)
# print(2)
# for tag_id in tags_v3_count_dict:
# for tag_id in tags_v3_count_dict:
# if tag_id not in projects_demands_tag_count:
# if tag_id not in projects_demands_tag_count:
...
...
output/output_article_distribution_0917.py
View file @
8f9fd6f2
...
@@ -4,14 +4,6 @@
...
@@ -4,14 +4,6 @@
# @email : litao@igengmei.com
# @email : litao@igengmei.com
# @author : litao
# @author : litao
# -*- coding:UTF-8 -*-
# @Time : 2020/9/11 10:59
# @File : portary_article_distribution.py
# @email : litao@igengmei.com
# @author : litao
import
hashlib
import
hashlib
import
json
import
json
...
...
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