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
b35d5900
Commit
b35d5900
authored
Mar 14, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change eda
parent
8907f684
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
eda.py
tensnsorflow/eda.py
+9
-14
No files found.
tensnsorflow/eda.py
View file @
b35d5900
...
@@ -5,18 +5,13 @@ import numpy as np
...
@@ -5,18 +5,13 @@ import numpy as np
import
datetime
import
datetime
import
time
import
time
def
con_sql
(
db
,
sql
):
def
con_sql
(
db
,
sql
):
cursor
=
db
.
cursor
()
cursor
=
db
.
cursor
()
try
:
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchone
()[
0
]
result
=
cursor
.
fetchall
()
df
=
pd
.
DataFrame
(
list
(
result
))
return
result
except
Exception
:
print
(
"发生异常"
,
Exception
)
df
=
pd
.
DataFrame
()
finally
:
db
.
close
()
return
df
def
test
(
days
):
def
test
(
days
):
...
@@ -25,11 +20,11 @@ def test(days):
...
@@ -25,11 +20,11 @@ def test(days):
sql
=
"select (select count(*) from train_data where stat_date = '{}' and y = 0)/(select count(*) "
\
sql
=
"select (select count(*) from train_data where stat_date = '{}' and y = 0)/(select count(*) "
\
"from train_data where stat_date = '{}' and z = 1)"
.
format
(
start
)
"from train_data where stat_date = '{}' and z = 1)"
.
format
(
start
)
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
exp
=
con_sql
(
db
,
sql
)[
0
]
.
values
.
tolist
()[
0
]
exp
=
con_sql
(
db
,
sql
)
print
(
exp
)
sql
=
"select (select count(*) from train_data where stat_date = '{}' and y = 1 and z = 0)/(select count(*) "
\
sql
=
"select (select count(*) from train_data where stat_date = '{}' and y = 1 and z = 0)/(select count(*) "
\
"from train_data where stat_date = '{}' and z = 1)"
.
format
(
start
)
"from train_data where stat_date = '{}' and z = 1)"
.
format
(
start
)
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
click
=
con_sql
(
db
,
sql
)
click
=
con_sql
(
db
,
sql
)[
0
]
.
values
.
tolist
()[
0
]
return
start
,
exp
,
click
return
start
,
exp
,
click
...
...
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