Update app.py
Browse files
app.py
CHANGED
|
@@ -115,7 +115,7 @@ def extract_features(tables):
|
|
| 115 |
oc = O.groupby("o_custkey").size().rename("cnt")
|
| 116 |
oa = C[["c_custkey"]].set_index("c_custkey").join(om).join(ox,rsuffix="_mx").join(oc).fillna(0)
|
| 117 |
o_f = norm(oa.values.astype(np.float32))
|
| 118 |
-
li = L.merge(O[["o_orderkey","o_custkey"]],
|
| 119 |
lm = li.groupby("o_custkey")[["l_quantity","l_extendedprice","l_discount","l_tax"]].mean()
|
| 120 |
lc = li.groupby("o_custkey").size().rename("cnt")
|
| 121 |
la = C[["c_custkey"]].set_index("c_custkey").join(lm).join(lc).fillna(0)
|
|
@@ -278,7 +278,7 @@ def train_xgboost(tables,log_fn=print):
|
|
| 278 |
f=C[["c_custkey","c_acctbal","c_nationkey","c_account_age_days","c_num_prev_orders"]].copy()
|
| 279 |
oa=O.groupby("o_custkey").agg(oc=("o_orderkey","count"),om=("o_totalprice","mean"),ox=("o_totalprice","max")).reset_index().rename(columns={"o_custkey":"c_custkey"})
|
| 280 |
f=f.merge(oa,on="c_custkey",how="left")
|
| 281 |
-
li=L.merge(O[["o_orderkey","o_custkey"]],
|
| 282 |
la=li.groupby("o_custkey").agg(lc=("l_quantity","count"),lp=("l_extendedprice","mean"),ld=("l_discount","mean")).reset_index().rename(columns={"o_custkey":"c_custkey"})
|
| 283 |
f=f.merge(la,on="c_custkey",how="left")
|
| 284 |
sw=li.merge(S,left_on="l_suppkey",right_on="s_suppkey",how="left")
|
|
|
|
| 115 |
oc = O.groupby("o_custkey").size().rename("cnt")
|
| 116 |
oa = C[["c_custkey"]].set_index("c_custkey").join(om).join(ox,rsuffix="_mx").join(oc).fillna(0)
|
| 117 |
o_f = norm(oa.values.astype(np.float32))
|
| 118 |
+
li = L.merge(O[["o_orderkey","o_custkey"]],left_on="l_orderkey",right_on="o_orderkey",how="left")
|
| 119 |
lm = li.groupby("o_custkey")[["l_quantity","l_extendedprice","l_discount","l_tax"]].mean()
|
| 120 |
lc = li.groupby("o_custkey").size().rename("cnt")
|
| 121 |
la = C[["c_custkey"]].set_index("c_custkey").join(lm).join(lc).fillna(0)
|
|
|
|
| 278 |
f=C[["c_custkey","c_acctbal","c_nationkey","c_account_age_days","c_num_prev_orders"]].copy()
|
| 279 |
oa=O.groupby("o_custkey").agg(oc=("o_orderkey","count"),om=("o_totalprice","mean"),ox=("o_totalprice","max")).reset_index().rename(columns={"o_custkey":"c_custkey"})
|
| 280 |
f=f.merge(oa,on="c_custkey",how="left")
|
| 281 |
+
li=L.merge(O[["o_orderkey","o_custkey"]],left_on="l_orderkey",right_on="o_orderkey",how="left")
|
| 282 |
la=li.groupby("o_custkey").agg(lc=("l_quantity","count"),lp=("l_extendedprice","mean"),ld=("l_discount","mean")).reset_index().rename(columns={"o_custkey":"c_custkey"})
|
| 283 |
f=f.merge(la,on="c_custkey",how="left")
|
| 284 |
sw=li.merge(S,left_on="l_suppkey",right_on="s_suppkey",how="left")
|