-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
ARROW-14685: [Python] test case automatically detects byteorder of numpy object #11686
Conversation
|
assert (df.dateTimeMs.dtype, df.dateTimeNs.dtype) == ( | ||
# O == object, <M8[ns] == timestamp64[ns] | ||
np.dtype("O"), np.dtype("<M8[ns]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not super familiar with those endianness details, but would it be sufficient to compare against "M8[ns]"
as well? (so without the explicit <
, assuming the check is then robust across platforms)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comment. This approach looks to work well.
>>> import numpy
>>> dt64 = numpy.datetime64('2002-06-28T01:00:00.000000000+0100', 's')
<stdin>:1: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
>>> dt64.dtype
dtype('>M8[s]')
>>> dt = numpy.dtype('M8[s]')
>>> print(dt64.dtype == dt)
True
>>> dtbe = numpy.dtype('>M8[s]')
>>> print(dt64.dtype == dtbe)
True
>>> dtle = numpy.dtype('<M8[s]')
>>> print(dt64.dtype == dtle)
False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Benchmark runs are scheduled for baseline = 30ac30f and contender = 3abab2e. 3abab2e is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
This PR fixes the following test failures