
17 Feb
2023
17 Feb
'23
3:53 p.m.
I agree. The problem can be avoided in a very inelegant way by turning warnings off before calling where() and turning them back on afterward, like this
warnings.filterwarnings("ignore", category=RuntimeWarning) result = np.where(x == 0.0, 0.0, 1./data) warnings.filterwarnings("always", category=RuntimeWarning)
But it would be MUCH nicer if there were an optional keyword argument in the where() call.
Thanks, Dave