[Numpy-discussion] 1.8.0, nan functions, and pandas

Charles R Harris charlesr.harris at gmail.com
Wed Oct 2 19:41:00 EDT 2013


On Wed, Oct 2, 2013 at 5:29 PM, Charles R Harris
<charlesr.harris at gmail.com>wrote:

> Hi All,
>
> There was a problem with pandas 0.12 and the numpy nan functions when
> applying the nansum function to a pandas Series object. We thought we had
> fixed it by the slight of hand use of `a.sum` instead of `add.reduce(a)` so
> that the Series object could use its own version of `sum` which overrides
> the ndarray version. However, the pandas sum method has a different
> signature, so success was illusory and due to not naming the keyword
> arguments in the call. The new nan functions nanmean, nanvar, and nanstd
> also failed, as the actually do name the keyword arguments. For pandas
> development all the functions work as the pandas sum method now include a
> `**kwargs` which gobbles up the missing keyword `keepdims`.
>
> At this point I don't think there is anything we can legitimately do to
> fix the pandas 0.12 problem. I propose to name all the keyword arguments
> arguments so that pandas fails, as it should, and simply document that the
> nan functions will not work with pandas versions < 0.13.
>
> Thoughts?
>
>
One thing we maybe should do is convert to arrays and wrap the result as we
do for the linalg functions. Currently, the nanfunctions happily keep
subtypes of ndarray and work with them. But I am not sure the usual
wrapping will work for Series. l note that Matrix also fails in the same
way as Series as it's sum function doesn't have a keepdims keyword. Hmm...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20131002/c99adb16/attachment.html>


More information about the NumPy-Discussion mailing list