-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
numpy/core/_methods.py:57: RuntimeWarning: invalid value encountered in double_scalars #2157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Perhaps you would be interested in MaskedArrays? Take a peek at Cheers!
|
Closing as this should have been reported to numpy, not to mpl. |
I was annoyed by numpy giving me sometimes this weird message. It turned out to be related to average() while not to median(). I see a pull #961 but containing same warning messages in comment from 'jdh2358'.
Anyway, here is my testcase:
$ python
Python 2.7.3 (default, Apr 20 2013, 18:28:22)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Sure, sometimes upstream code passes an empty list but I believe that is perfectly valid requirement. Please make your code more defensive. ;-)
Personally am not happy at all with those NaN values but if you insist, return NaN in case of average() like you already do for median(). I zap them myself with None.
A more general note on why I don't like NaN and how I got into the issue:
def fix_clean_lists(indexes, func, _in, _out):
"""Overwrite NaN values (numpy.float64) with None or keep the float for
average or round the float to integer for medians.
"""
The text was updated successfully, but these errors were encountered: