How to clip just one column of dataframe
You can also use inplace=True
to avoid the assignment:
dfo['value'].clip(upper=100, inplace=True)
You can specify column:
dfo['value'] = dfo['value'].clip(upper=100)
If possible multiple columns:
cols = ['value', 'another col']
dfo[cols] = dfo[cols].clip(upper=100)
Or if need clip all numeric columns filter them by DataFrame.select_dtypes
:
cols = df.select_dtypes(np.number).columns
dfo[cols] = dfo[cols].clip(upper=100)