Skip to content

TST: Test datetime array assignment with different units (#7492) #14884

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 2 commits into from
Dec 17, 2016

Conversation

mroeschke
Copy link
Member

The example in this issue currently works in master. Added a test to confirm. Based on a quick skim of the recent PRs, doesn't look like it was fixed recently.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Nice!

# OutOfBoundsDatetime error shouldn't occur
data_s = np.array([1, 'nat'], dtype='datetime64[s]')
result['new'] = data_s
expected = pd.DataFrame({0: data_ns, 'new': data_s})
Copy link
Member

Choose a reason for hiding this comment

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

Probably not needed to assert the original bug, but I would create the expected frame independently of data_s (eg pd.DataFrame({0:[1e9, None], 'new': [1e9, None]}, dtype='datetime64[ns]'))

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the guidance! I'll make that change later tonight.

@jorisvandenbossche jorisvandenbossche added Testing pandas testing functions or related to the test suite Datetime Datetime data dtype labels Dec 15, 2016
@jorisvandenbossche jorisvandenbossche added this to the 0.20.0 milestone Dec 15, 2016
@codecov-io
Copy link

Current coverage is 85.30% (diff: 100%)

No coverage report found for master at 3ba2cff.

Powered by Codecov. Last update 3ba2cff...56fdc1f

@mroeschke
Copy link
Member Author

Changes made and all green.

@jorisvandenbossche jorisvandenbossche merged commit 906b51a into pandas-dev:master Dec 17, 2016
@jorisvandenbossche
Copy link
Member

@mroeschke Thanks!

@mroeschke mroeschke deleted the test_7492 branch December 21, 2016 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assigning datetime array to column fails with OutOfBoundsDatetime when having NaT and other unit as [ns]
3 participants