Commit 6535a54b authored by 张彦钊's avatar 张彦钊

add

parent 30297e78
......@@ -51,6 +51,9 @@ def get_data():
return result
def get_ctr():
pass
if __name__ == "__main__":
DIRECTORY_PATH = "/home/gmuser/"
df = pd.DataFrame(list(get_data()))
......
......@@ -113,6 +113,7 @@ def search():
break
cursor = new_cursor
if __name__ == "__main__":
search()
......
......@@ -133,21 +133,38 @@ def hospital_to_csv():
df.to_csv('/tmp/device/hospital.csv', index=False)
def ctr(type):
sql = "select stat_date,new_grey_exp,new_grey_click,new_grey_ctr,new_grey_exp_device," \
"new_grey_click_device,new_normal_exp,new_normal_click,new_normal_ctr,new_normal_exp_device," \
"new_normal_click_device,old_exp,old_click,old_ctr,old_exp_device,old_click_device " \
"from '{}'".format(type)
df = pd.DataFrame(list(get_mysql_data(host, port, user, passwd, db, sql)))
name = ["stat_date","new_grey_exp","new_grey_click","new_grey_ctr","new_grey_exp_device",
"new_grey_click_device","new_normal_exp","new_normal_click","new_normal_ctr","new_normal_exp_device,"
"new_normal_click_device","old_exp,old_click","old_ctr","old_exp_device","old_click_device"]
columns = dict(zip(list(range(len(name))), name))
df = df.rename(columns=columns)
df.to_csv('/home/gmuser/{}_ctr.csv'.format(type), index=False)
if __name__ == "__main__":
host = "172.16.30.141"
port = 3306
user = "work"
passwd = "BJQaT9VzDcuPBqkd"
db = "zhengxing"
yconnect = create_engine('mysql+pymysql://root:3SYz54LS9#^9sBvC@172.16.40.170:4000/jerry_test?charset=utf8')
meigou_tag_to_csv()
print("end")
# host = "172.16.40.170"
# port = 4000
# user = "root"
# passwd = "3SYz54LS9#^9sBvC"
# db = "jerry_test"
# host = "172.16.30.141"
# port = 3306
# user = "work"
# passwd = "BJQaT9VzDcuPBqkd"
# db = "zhengxing"
# yconnect = create_engine('mysql+pymysql://root:3SYz54LS9#^9sBvC@172.16.40.170:4000/jerry_test?charset=utf8')
# meigou_tag_to_csv()
# print("end")
host = "172.16.40.170"
port = 4000
user = "root"
passwd = "3SYz54LS9#^9sBvC"
db = "jerry_test"
ctr(type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment