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

增加保存到csv

parent 8eca148c
...@@ -53,7 +53,7 @@ def get_data(): ...@@ -53,7 +53,7 @@ def get_data():
def transform(df,table): def transform(df,table):
model = multiFFMFormatPandas() model = multiFFMFormatPandas()
df = model.fit_transform(df, y="y", n=50000, processes=20) df = model.fit_transform(df, y="y", n=80000, processes=20)
df = pd.DataFrame(df) df = pd.DataFrame(df)
df["device_id"] = df[0].apply(lambda x: x.split(",")[0]) df["device_id"] = df[0].apply(lambda x: x.split(",")[0])
df["city_id"] = df[0].apply(lambda x: x.split(",")[1]) df["city_id"] = df[0].apply(lambda x: x.split(",")[1])
...@@ -62,7 +62,7 @@ def transform(df,table): ...@@ -62,7 +62,7 @@ def transform(df,table):
df["seq"] = list(range(df.shape[0])) df["seq"] = list(range(df.shape[0]))
df["seq"] = df["seq"].astype("str") df["seq"] = df["seq"].astype("str")
df["ffm"] = df[0].apply(lambda x: x.split(",")[3:]) df["ffm"] = df[0].apply(lambda x: x.split(",")[3:])
df["ffm"] = df["seq"].str.cat(df["ffm"], sep=",") df["ffm"] = df["seq"].str.cat([df["ffm"].values.tolist()], sep=",")
df["random"] = np.random.randint(1, 2147483647, df.shape[0]) df["random"] = np.random.randint(1, 2147483647, df.shape[0])
df = df.drop(0, axis=1).drop("seq",axis=1) df = df.drop(0, axis=1).drop("seq",axis=1)
print("size") print("size")
......
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