Skip to content

Commit

Permalink
fix bug with calc in sums
Browse files Browse the repository at this point in the history
  • Loading branch information
TheColdIce committed Aug 26, 2024
1 parent 9c60e06 commit cfd9c7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion preprocess/feature_engineering.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def cal_node_features(df:pd.DataFrame, bank, windows=1) -> pd.DataFrame:
# calculate network features
for window in windows:
gb = df_network[(df_network['step']>=window[0])&(df_network['step']<=window[1])].groupby(['account'])
df_nodes[f'in_sums_{window[0]}_{window[1]}'] = gb['amount'].sum()
df_nodes[f'in_sums_{window[0]}_{window[1]}'] = gb['amount'].apply(lambda x: x[x > 0].sum())
df_nodes[f'out_sums_{window[0]}_{window[1]}'] = gb['amount'].apply(lambda x: x[x < 0].sum())
df_nodes[f'sums_{window[0]}_{window[1]}'] = gb['amount'].sum()
df_nodes[f'means_{window[0]}_{window[1]}'] = gb['amount'].mean()
Expand Down

0 comments on commit cfd9c7b

Please sign in to comment.