I\'m trying to set a maximum value of a pandas DataFrame column. For example:
my_dict = {\'a\':[10,12,15,17,19,20]} df = pd.DataFrame(my_dict) df[\'a\'].se
You can use clip.
Apply to all columns of the data frame:
df.clip(upper=15)
Otherwise apply to selected columns as seen here:
df.clip(upper=pd.Series({'a': 15}), axis=1)