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
69aa7b29
Commit
69aa7b29
authored
Sep 03, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get between date to stat back features
parent
93b9b034
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
grayStat.py
eda/gray_stat/grayStat.py
+7
-3
utils.py
eda/gray_stat/utils.py
+17
-0
No files found.
eda/gray_stat/grayStat.py
View file @
69aa7b29
# -*- coding: UTF-8 -*-
from
utils
import
con_sql
,
get_yesterday_date
from
utils
import
con_sql
,
get_yesterday_date
,
get_between_day
import
time
OUTPUT_PATH
=
"/data2/models/eda/gray_stat/"
...
...
@@ -60,6 +60,10 @@ class GrayStat(object):
if
__name__
==
'__main__'
:
date_list
=
get_between_day
(
'2018-08-20'
,
'2018-08-29'
)
for
i
in
date_list
:
print
(
"开始获取ffm中的灰度非灰度比例"
)
start
=
time
.
time
()
#1.ffm中的灰度非灰度(ios和安卓一样):
...
...
@@ -71,7 +75,7 @@ if __name__ == '__main__':
grays
=
[
'6'
,
'8'
]
for
platform
in
platforms
:
for
gray
in
grays
:
g_class
=
GrayStat
(
'diary'
,
gray
,
platform
)
g_class
=
GrayStat
(
'diary'
,
gray
,
platform
,
i
)
uid_count
=
g_class
.
get_uid_count
()
uid_clk_times
=
g_class
.
get_uid_clk_times
()
uid_imp_times
=
g_class
.
get_uid_imp_times
()
...
...
@@ -117,7 +121,7 @@ if __name__ == '__main__':
else
:
grays
=
[
'0|1|2|6|8'
,
'^01268'
]
for
gray
in
grays
:
g_class
=
GrayStat
(
'diary'
,
gray
,
platform
)
g_class
=
GrayStat
(
'diary'
,
gray
,
platform
,
i
)
uid_count
=
g_class
.
get_uid_count
()
uid_clk_times
=
g_class
.
get_uid_clk_times
()
uid_imp_times
=
g_class
.
get_uid_imp_times
()
...
...
eda/gray_stat/utils.py
View file @
69aa7b29
...
...
@@ -35,3 +35,19 @@ def get_yesterday_date():
yesterday
=
today
-
datetime
.
timedelta
(
days
=
1
)
yesterday
=
yesterday
.
strftime
(
"
%
Y-
%
m-
%
d"
)
return
yesterday
def
getBetweenDay
(
begin_date
,
end_date
):
#获取指定时间范围内的date
"""
type begin_date : str eg:'2018-08-29'
type end_date : str eg:'2018-09-01'
rtype : list eg:['2018-08-29','2018-08-30','2018-08-31','2018-09-01']
"""
date_list
=
[]
begin_date
=
datetime
.
datetime
.
strptime
(
begin_date
,
"
%
Y-
%
m-
%
d"
)
end_date
=
datetime
.
datetime
.
strptime
(
end_date
,
"
%
Y-
%
m-
%
d"
)
while
begin_date
<=
end_date
:
date_str
=
begin_date
.
strftime
(
"
%
Y-
%
m-
%
d"
)
date_list
.
append
(
date_str
)
begin_date
+=
datetime
.
timedelta
(
days
=
1
)
return
date_list
\ No newline at end of file
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