Is it possible to write an "if statement" into a lambda functions in python? I am trying to write something along these lines but I am getting a syntax error after the if statement:
filt_sin = snf.generic_filter(lambda x: np.std(sin, (size, size) if x<=sin_std), sin, size=size, mode="nearest")