Pandas
Filter
-
filter with multiple condition
df_filtered = df[ (df.D>0) & df.C<0) ] df_filtered = df[ (df['D']>0) & df['C']<0) ]
-
filter with isin
alist = [12,312,53] df_filtered = df[ df['D'].isin(alist) ]
-
Ref
Indicator of apply when using pandas
-
using the
tqdm
modeloriginally:
df.groupby(['feature1', 'feature2']).apply(feature_rollup)
using tqdm:
from tqdm import tqdm tqdm.pandas(tqdm()) df.groupby(['feature1', 'feature2']).progress_apply(feature_rollup)
-
Ref