-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
possible error in mean of dataframe with nan values? #763
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
the problem is apparently in _nanmean, where it does |
ok, this happens when the dataframe that I use is of type object: In [209]: np.array((1,2,3),dtype=object)/np.array((0,0,0))ZeroDivisionError Traceback (most recent call last) ZeroDivisionError: integer division or modulo by zero In [210]: np.array((1,2,3),dtype=float)/np.array((0,0,0)) so not really a pandas problem |
Seems like even as object, works now in latest git master:
|
I recall working on this sometime in the last month. @CRP can you verify that things work on git master? |
just did and it appears to work fine thanks |
Do not use bytes when loading back pickled objects
I am not sure if I am doing something wrong, but this looks like a bug to me:
In [116]: ra.ix[:5,:5]
Out[116]:
005665 023740 028758 040828 045449
2011-05-09 NaN NaN NaN NaN NaN
2011-05-10 -0.00284467268624 0.0 0.0 -0.002844627571 0.000353248710642
2011-05-11 -0.00674436854779 0.0 0.0 -0.00674432257973 0.0
2011-05-12 0.0117105570627 0.0 0.0 0.0117104073878 0.0
2011-05-13 0.00367090573068 0.0 0.0 -0.00102855609881 0.0
In [117]: ra.ix[:5,:5].mean(axis=0,skipna=True)
Out[117]:
005665 0.0014481
023740 0.0000000
028758 0.0000000
040828 0.0002732
045449 8.831e-05
In [118]: ra.ix[:5,:5].mean(axis=1,skipna=True)
Out[118]:
2011-05-09 NaN
2011-05-10 NaN
2011-05-11 NaN
2011-05-12 NaN
2011-05-13 NaN
In [122]: ra.ix[1:5,:5].mean(axis=1,skipna=True)
Out[122]:
2011-05-10 -0.0010672
2011-05-11 -0.0026977
2011-05-12 0.0046842
2011-05-13 0.0005285
In step 118, I would expect the same output I get at step 122. Maybe the check if values are all NaN on a given row are done on the wrong axis?
The text was updated successfully, but these errors were encountered: