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
ca2a9bcc
Commit
ca2a9bcc
authored
Oct 24, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change
parent
301fbcd0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
ctr_exp.py
ctr_exp.py
+4
-1
No files found.
ctr_exp.py
View file @
ca2a9bcc
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
pymysql
import
pymysql
import
datetime
import
datetime
import
pandas
as
pd
import
pandas
as
pd
from
sqlalchemy
import
create_engine
def
get_yesterday_date
():
def
get_yesterday_date
():
...
@@ -57,5 +58,7 @@ if __name__ == "__main__":
...
@@ -57,5 +58,7 @@ if __name__ == "__main__":
df
=
df
.
rename
(
columns
=
{
0
:
"cid"
,
1
:
"exp"
,
2
:
"click"
})
df
=
df
.
rename
(
columns
=
{
0
:
"cid"
,
1
:
"exp"
,
2
:
"click"
})
df
[
"click"
]
=
df
[
"click"
]
.
fillna
(
0
)
df
[
"click"
]
=
df
[
"click"
]
.
fillna
(
0
)
df
[
"ctr"
]
=
df
[
"click"
]
/
df
[
"exp"
]
df
[
"ctr"
]
=
df
[
"click"
]
/
df
[
"exp"
]
print
(
df
.
head
(
6
))
yconnect
=
create_engine
(
'mysql+pymysql://root:3SYz54LS9#^9sBvC@172.16.40.158:4000/jerry_test?charset=utf8'
)
pd
.
io
.
sql
.
to_sql
(
df
,
"diary_ctr_new"
,
yconnect
,
schema
=
'jerry_test'
,
if_exists
=
'append'
,
index
=
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