Skip to content

BUG: ensure_datetime64ns with bigendian array #30976

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 3 commits into from
Jan 14, 2020

Conversation

jbrockmendel
Copy link
Member

@@ -99,6 +99,11 @@ def ensure_datetime64ns(arr: ndarray, copy: bool=True):

shape = (<object>arr).shape

if (<object>arr).dtype.byteorder == ">":
# GH#29684 we incorrectly get OutOfBoundsDatetime if we dont swap
Copy link
Member

Choose a reason for hiding this comment

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

Do you know where this actually is causing the problem? Are we doing some low level byte swapping elsewhere in our code or just something getting thrown off in interfacing with numpy?

Copy link
Member Author

Choose a reason for hiding this comment

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

When we do the arr.view(np.int64) that view is little-endian

@WillAyd WillAyd added the Datetime Datetime data dtype label Jan 13, 2020
@simonjayhawkins simonjayhawkins added the Regression Functionality that used to work in a prior pandas version label Jan 13, 2020
@simonjayhawkins simonjayhawkins added this to the 1.0.0 milestone Jan 13, 2020
@TomAugspurger
Copy link
Contributor

I think a test that directly hits the user-facing behavior of pd.Series(big_endian_array) would be valuable to ensure we don't regress in a future refactor.

@TomAugspurger
Copy link
Contributor

What do people think about backporting this? IMO it's appropriate for 1.0.1, but we don't have backports to that setup yet. So 1.0.0 is probably best.

We also need a whatsnew for this, but that depends on the decision for where this should go.

@WillAyd
Copy link
Member

WillAyd commented Jan 13, 2020

I guess I view 1.0.1 as reserved for regressions introduced in 1.0 which this wouldn't fall under, so very soft preference for 1.1 but not losing sleep in either case

@jreback jreback modified the milestones: 1.0.0, 1.1 Jan 14, 2020
@jreback
Copy link
Contributor

jreback commented Jan 14, 2020

-1 on backporting this; we have very little support for big-endian at all and no testing. In fact, @jbrockmendel how do you know this actually works?

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.

commemts

@jreback jreback removed this from the 1.1 milestone Jan 14, 2020
@jbrockmendel
Copy link
Member Author

In fact, @jbrockmendel how do you know this actually works?

Because you can pass a big-endian dtype even on a little-endian system. The added test does this.

@jreback
Copy link
Contributor

jreback commented Jan 14, 2020

In fact, @jbrockmendel how do you know this actually works?

Because you can pass a big-endian dtype even on a little-endian system. The added test does this.

disagree; we cannot reproduce the error. It would be ok to have the OP try to repro with this patch though. Not objecting to the change, but we don't have any testing whatsoever.

@jbrockmendel
Copy link
Member Author

disagree; we cannot reproduce the error

We can. Try the tests this adds on master.

@jreback
Copy link
Contributor

jreback commented Jan 14, 2020

disagree; we cannot reproduce the error

We can. Try the tests this adds on master.

we don't have tests on a big-endian CI.

@jbrockmendel
Copy link
Member Author

we don't have tests on a big-endian CI.

I'm aware. I'm saying that when I run the test on my little-endian computer, it fails in master and passes after this PR.

@jreback jreback added this to the 1.1 milestone Jan 14, 2020
@jreback jreback merged commit 81d9636 into pandas-dev:master Jan 14, 2020
@jreback
Copy link
Contributor

jreback commented Jan 14, 2020

k thanks @jbrockmendel

not harassing you about testing, just skeptical of big-endian testing generally

@jbrockmendel jbrockmendel deleted the bug-bigendian branch January 14, 2020 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OutOfBoundsDatetime for big-endian np.datetime64 arrays
5 participants