-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsReduction Operationssum, mean, min, max, etc.sum, mean, min, max, etc.
Description
Min doesn't seem to work as expected with NaNs and non-numeric data:
In [1]: s = pd.Series(['alpha', np.nan, 'charlie', 'delta'])
In [2]: s
Out[2]:
0 alpha
1 NaN
2 charlie
3 delta
dtype: object
In [3]: s.min() # by default docstring suggests this should skipnan
Out[3]: inf
The hack/workaround is to exclude them, perhaps we should special case this in the code:
In [4]: s[s.notnull()].min()
Out[4]: 'alpha'
From discussion on this pandas SO question. and I also posted a corresponding numpy issue:
numpy/numpy#3508.
Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsReduction Operationssum, mean, min, max, etc.sum, mean, min, max, etc.