You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/11/16 01:21:21 UTC
[GitHub] [arrow] kiszk commented on a change in pull request #11686: ARROW-14685: [Python] test case automatically detects byteorder of numpy object
kiszk commented on a change in pull request #11686:
URL: https://github.com/apache/arrow/pull/11686#discussion_r749827236
##########
File path: python/pyarrow/tests/test_pandas.py
##########
@@ -4328,9 +4328,14 @@ def make_df_with_timestamps():
})
# Not part of what we're testing, just ensuring that the inputs are what we
# expect.
+ if sys.byteorder == "little":
+ datetime_dtype = "<M8[ns]"
+ else:
+ datetime_dtype = ">M8[ns]"
assert (df.dateTimeMs.dtype, df.dateTimeNs.dtype) == (
- # O == object, <M8[ns] == timestamp64[ns]
- np.dtype("O"), np.dtype("<M8[ns]")
Review comment:
Thank you for your comment. This approach looks 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
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org