0

When I take the nanmean of an array that has an all-empty slice I get the warning "RuntimeWarning: Mean of empty slice". I think this is fairly obvious - but what is the easiest way to resolve this warning but still get the same behavior without more broadly suppressing warnings?

np.nanmean([np.array([np.nan]), np.array([np.nan])], axis = 0) = np.nan (warning triggered)
np.nanmean([np.array([np.nan]), np.array([1])], axis = 0)      = 1.0
jared
  • 4,165
  • 1
  • 8
  • 31
negfrequency
  • 1,801
  • 3
  • 18
  • 30
  • Does this answer your question? [How to get rid of specific warning messages in python while keeping all other warnings as normal?](https://stackoverflow.com/questions/9134795/how-to-get-rid-of-specific-warning-messages-in-python-while-keeping-all-other-wa) – Nin17 Aug 10 '23 at 14:44

0 Answers0