Skip to content
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

Need to exclude NA values with dtype=object in stat methods #469

Closed
wesm opened this issue Dec 11, 2011 · 1 comment
Closed

Need to exclude NA values with dtype=object in stat methods #469

wesm opened this issue Dec 11, 2011 · 1 comment
Labels
Milestone

Comments

@wesm
Copy link
Member

wesm commented Dec 11, 2011

reported by @npinger, regression from 0.5.0 I think.

import pandas
lis = [1, 3, 5, None, 7]
index = [1, 2, 3, 4, 5]
ser = pandas.core.series.Series(data=lis, index=index)
ser.mean()

Gives this error:

Traceback (most recent call last):
File "", line 1, in
File ".../pandas/core/series.py", line 650, in mean
return nanops.nanmean(self.values, skipna=skipna)
File ".../pandas/core/nanops.py", line 30, in nanmean
the_mean = values.sum(axis) / float(values.shape[axis])
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

import pandas
import numpy as np
lis = [1, 3, 5, np.nan, 7]
index = [1, 2, 3, 4, 5]
ser = pandas.core.series.Series(data=lis, index=index)
ser.mean()
(gives no error)

@wesm
Copy link
Member Author

wesm commented Dec 12, 2011

fixed in git master

dan-nadler pushed a commit to dan-nadler/pandas that referenced this issue Sep 23, 2019
Fix the failing integration test due to the Mongo upgrade to 3.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant