-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone
Description
Index and Series min and max handles nan and NaT differently. Even though min and max are defined in IndexOpsMixin, Series doesn't use them and use NDFrame definitions.
pd.Index([np.nan, 1.0]).min()
# nan
pd.Index([np.nan, 1.0]).max()
# nan
pd.DatetimeIndex([pd.NaT, '2011-01-01']).min()
# NaT
pd.DatetimeIndex([pd.NaT, '2011-01-01']).max()
#2011-01-01 00:00:00
# Series excludes nan and NaT
pd.Series([np.nan, 1.0]).min()
#1.0
pd.Series([np.nan, 1.0]).max()
#1.0
pd.Series([pd.NaT, pd.Timestamp('2011-01-01')]).min()
#2011-01-01 00:00:00
pd.Series([pd.NaT, pd.Timestamp('2011-01-01')]).max()
#2011-01-01 00:00:00
Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate