Commit e3f29305 authored by 张彦钊's avatar 张彦钊

add shape

parent f1a8239a
......@@ -47,13 +47,12 @@ def get_data():
# print(df.head())
print("shape")
print(df.shape)
device_tuple = tuple(set(df["device_id"].values.tolist()))
df = pd.merge(df,get_statistics(),how='left').fillna(0)
print("merge")
print(df.head())
print("shape")
print(df.shape)
df = df.drop("device_id", axis=1)
# df = df.drop("device_id", axis=1)
# transform(df)
......@@ -100,7 +99,7 @@ def get_statistics():
sql = "select device_id,device_type,total,精选,直播,鼻部,眼部,微整,牙齿,轮廓,美肤抗衰," \
"吸脂,脂肪填充,隆胸,私密,毛发管理,公立,韩国 from home_tab_click"
df = con_sql(db, sql).drop_duplicates()
df = df.rename(columns={0:"device_id",1:"device_type",2:"channel",3:"total"})
df = df.rename(columns={0:"device_id",1:"device_type",2:"total"})
# for i in df.columns.difference(["device_id", "device_type","channel","total"]):
# df[i] = df[i]/df["total"]
# df = df.drop("total", axis=1)
......
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