-
Notifications
You must be signed in to change notification settings - Fork 3.9k
ARROW-10768: [Python] pass ndim to pandas make_block #8957
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
Conversation
|
Thanks for opening a pull request! Could you open an issue for this pull request on JIRA? Then could you also rename pull request title in the following format? See also: |
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 for looking at this. The tests are failing, though.
For future reference, please reference the JIRA issue that you opened in the PR
python/pyarrow/pandas_compat.py
Outdated
| elif 'timezone' in item: | ||
| dtype = make_datetimetz(item['timezone']) | ||
| cls = dtype.construct_array_type() | ||
| block_arr = cls._simple_new(block_arr, dtype=dtype) |
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.
this line seems to cause the failures on latest pandas. So if the previous way was working, I would keep it that way (in addition, although pyarrow is already using private APIs here, _simple_new is even more a private implementation detail, so I would prefer not using it)
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.
In addition, the dtype.construct_array_type() line is failing on older pandas releases. So reverting this change might solve that as well.
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.
IIRC the motivation here was to stop passing dtype to make_block, since that kwarg isnt used within pandas and AFAICT this usage is the blocker to deprecating/removing it. could be considered separate from the matter at hand, but while im in the neighborhood
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.
OK, I understand.
Now, next problem: also DatetimeArray is not yet available on the older pandas versions ..
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.
(now we could do something else depending on the pandas version)
|
@jbrockmendel Do you want to update this PR? |
python/pyarrow/pandas_compat.py
Outdated
| except ImportError: | ||
| # older pandas versions | ||
| from pandas import DatetimeIndex | ||
| block_arr = DatetimeIndex(block_arr, dtype=dtype) |
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.
This is also failing on older pandas. I assume because DatetimeArray and DatetimeIndex might be interpreting datetime64 differently? (wall time vs unix time? didn't check, but I remember discussions about it)
d4608a9 to
356c300
Compare
|
closing, as pandas can now deal with this internally. |
xref pandas-dev/pandas#38134 pandas will require passing ndim to make_block, this updates to the new usage
cc @jorisvandenbossche