Skip to content

BUG: NaT does not propagate in row-wise max for datetime64 rows #36907

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

Closed
2 of 3 tasks
isVoid opened this issue Oct 6, 2020 · 0 comments · Fixed by #37425
Closed
2 of 3 tasks

BUG: NaT does not propagate in row-wise max for datetime64 rows #36907

isVoid opened this issue Oct 6, 2020 · 0 comments · Fixed by #37425
Labels
Bug Reduction Operations sum, mean, min, max, etc.
Milestone

Comments

@isVoid
Copy link
Contributor

isVoid commented Oct 6, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

import pandas as pd
pdf = pd.DataFrame()
pdf['a'] = pd.Series(['2020-01-01 08:00:00', '1920-02-01 09:00:00'], dtype='datetime64[ns]')
pdf['b'] = pd.Series(['2020-02-01 08:00:00', pd.NaT], dtype='datetime64[ns]')
pdf.max(axis=1, skipna=False)

Problem description

Current output is

0   2020-02-01 08:00:00
1   1920-02-01 09:00:00
dtype: datetime64[ns]

In general, missing values involved in reduction should propagate.

Expected Output

0   2020-02-01 08:00:00
1   NaT
dtype: datetime64[ns]

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit : 2a7d332 python : 3.7.8.final.0 python-bits : 64 OS : Linux OS-release : 5.4.0-48-generic Version : #52~18.04.1-Ubuntu SMP Thu Sep 10 12:50:22 UTC 2020 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : None LOCALE : en_US.UTF-8

pandas : 1.1.2
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.6.0.post20200917
Cython : 0.29.21
pytest : 6.1.1
hypothesis : 5.28.0
sphinx : 3.2.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.3.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 0.8.3
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 1.0.1
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.51.0rc1

@isVoid isVoid added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 6, 2020
@jbrockmendel jbrockmendel added the Reduction Operations sum, mean, min, max, etc. label Oct 8, 2020
@jreback jreback added this to the 1.2 milestone Oct 27, 2020
@simonjayhawkins simonjayhawkins removed the Needs Triage Issue that has not been reviewed by a pandas team member label Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reduction Operations sum, mean, min, max, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants