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

Dont check for NaTType, just NaT #17564

Merged
merged 4 commits into from
Sep 23, 2017
Merged

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change, other lgtm.

@@ -572,7 +572,7 @@ def test_implementation_limits(self):
assert max_td.value == np.iinfo(np.int64).max

# Beyond lower limit, a NAT before the Overflow
assert isinstance(min_td - Timedelta(1, 'ns'), NaTType)
assert min_td - Timedelta(1, 'ns') is NaT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use parens

@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Datetime Datetime data dtype labels Sep 17, 2017
@@ -470,7 +469,7 @@ def encode(obj):
}

elif isinstance(obj, (datetime, date, np.datetime64, timedelta,
np.timedelta64, NaTType)):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI:

In [40]: np.timedelta64('nat') is pd.NaT
Out[40]: False

In [41]: pd.Timedelta(np.timedelta64('nat')) is pd.NaT
Out[41]: True

this is reason for the complex type checking around NaTs; numpy has a 'nat' like value embedded in np.timedelta64/np.datetime64 (however its not very useful).

@jreback jreback added this to the 0.21.0 milestone Sep 17, 2017
@jreback
Copy link
Contributor

jreback commented Sep 17, 2017

lgtm. merge on green.

@jbrockmendel
Copy link
Member Author

Test error is in pyarrow, which I haven't looked at closely. Does it instantiate a new instance of NaTType for some reason?

@jreback
Copy link
Contributor

jreback commented Sep 19, 2017

no just rebase

@codecov
Copy link

codecov bot commented Sep 19, 2017

Codecov Report

Merging #17564 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17564      +/-   ##
==========================================
- Coverage   91.19%   91.17%   -0.02%     
==========================================
  Files         163      163              
  Lines       49626    49625       -1     
==========================================
- Hits        45258    45248      -10     
- Misses       4368     4377       +9
Flag Coverage Δ
#multiple 88.96% <100%> (-0.01%) ⬇️
#single 40.19% <0%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/timedeltas.py 91.19% <100%> (ø) ⬆️
pandas/io/packers.py 88.19% <100%> (-0.04%) ⬇️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.77% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3795272...663ba90. Read the comment docs.

@jreback jreback merged commit 148200f into pandas-dev:master Sep 23, 2017
@jreback
Copy link
Contributor

jreback commented Sep 23, 2017

thanks!

@jbrockmendel jbrockmendel deleted the no_nattype branch October 30, 2017 16:24
alanbato pushed a commit to alanbato/pandas that referenced this pull request Nov 10, 2017
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants