Oftentimes our filtering logic involves applying the same logical expression to multiple columns. Implicit filtering allows us to succinctly apply one or more logical expressions to one or more columns and then combine the results without repeating code.
A typical implicit filtering solution looks like so:
df_2 = df.loc[(df[['col_1', 'col_3', 'col_5']]
.apply(pd.isna)
.any(axis=1))]
Implicit filtering involves three aspects:
TRUE
or FALSE
) to apply to each of the selected columns which we cover in Function Specification.