Skip to content

BUG: DTI/TDI .insert accepting incorrectly-dtyped NaT #30754

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

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

jbrockmendel
Copy link
Member

Also TDI.insert trying to parse strings to Timedelta, which neither DTI nor PI do.

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.

some followon comments

@@ -317,7 +317,9 @@ def test_take_fill_value_with_timezone(self):


class TestDatetimeIndex:
@pytest.mark.parametrize("null", [None, np.nan, pd.NaT])
@pytest.mark.parametrize(
"null", [None, np.nan, np.datetime64("NaT"), pd.NaT, pd.NA]
Copy link
Contributor

Choose a reason for hiding this comment

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

should create a fixture like this (similar to nulls_fixture), but this is more datetime specialized, but for another pass.

@@ -326,6 +328,12 @@ def test_insert_nat(self, tz, null):
res = idx.insert(0, null)
tm.assert_index_equal(res, expected)

@pytest.mark.parametrize("tz", [None, "UTC", "US/Eastern"])
Copy link
Contributor

Choose a reason for hiding this comment

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

try to fixturize at some point (the tzs)

@@ -219,11 +219,29 @@ def test_insert(self):
assert result.name == expected.name
assert result.freq == expected.freq

@pytest.mark.parametrize(
"null", [None, np.nan, np.timedelta64("NaT"), pd.NaT, pd.NA]
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to above

@jreback jreback added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Jan 6, 2020
@jreback jreback added this to the 1.0 milestone Jan 6, 2020
@jreback jreback added the Timedelta Timedelta data type label Jan 6, 2020
@jreback jreback merged commit b1e77f9 into pandas-dev:master Jan 6, 2020
@jreback
Copy link
Contributor

jreback commented Jan 6, 2020

thanks (technically should have a whatsnew, but this is a very very tiny edge case), but if you can in a followon ok.

@jbrockmendel jbrockmendel deleted the ref-insert2 branch January 7, 2020 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants