Skip to content

.min() on a series of NaTs returns nan, while .max() returns NaT #23282

Closed
@ericstarr

Description

@ericstarr

Code Sample

s = pd.Series([pd.NaT, pd.NaT])

# Returns nan
s.min()

# Returns NaT
s.max()

Problem description

Calling .min() on an series of NaT returns nan. I would expect this to return NaT to as to keep the type the same. Also, whether it returns nan or NaT, I would expect it to be consistent with .max(). I'm on version 0.22, not 0.23, so maybe it was fixed in the latest version, but I didn't see an issue addressing it.

Expected Output

I would expect that the s.min() call would also return NaT.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.5.4.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.22.0
pytest: None
pip: 10.0.1
setuptools: 40.2.0
Cython: None
numpy: 1.15.1
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.5.0
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: 1.2.11
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions