I am trying to remove outliers from columns. Lets say I have:
rand_df = pd.DataFrame({"A": [1,2,3], 'B': [4,5,6]})
If I do:
rand_df = rand_df[rand_df['A'] > 2]
I get a new df which is what I want. However if I try:
def some_fxn(df, col):
df = df[df[col] > 2]
some_fxn(rand_df, 'A')
My df is unaltered. What do I need to do to enable this function to operate properly?