To do conditional replace with Python Pandas, we can return the items we want to replace and then replace them.
For instance, we write
mask = df.my_channel > 20000 column_name = 'my_channel' df.loc[mask, column_name] = 0
to replace them items returned by
mask, which is the rows with
my_channel column values that are bigger than 20000.
Then we use
df.loc[mask, column_name] = 0
to replace the returned rows and columns with .