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

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

Closed
ericstarr opened this issue Oct 22, 2018 · 1 comment · Fixed by #23289
Closed

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

ericstarr opened this issue Oct 22, 2018 · 1 comment · Fixed by #23289
Labels
Bug Datetime Datetime data dtype Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@ericstarr
Copy link

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

@mroeschke
Copy link
Member

Thanks for the report. I am seeing this behavior on master too. Also looks similar to #10390.

Investigations and PRs welcome!

@mroeschke mroeschke added Bug Datetime Datetime data dtype Numeric Operations Arithmetic, Comparison, and Logical operations labels Oct 22, 2018
@jreback jreback added this to the Contributions Welcome milestone Oct 23, 2018
@jreback jreback modified the milestones: Contributions Welcome, 0.24.0 Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants