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
[Python] Add Array.to_numpy functions #18249
Comments
Jim Pivarski / @jpivarski: This function could be an inverse of pyarrow.ListArray.from_arrays, something that returns the offsets and contents as Numpy arrays for a List and something more complex for general cases (a dict from strings representing a place in the hierarchy to Numpy arrays?). A simpler interface that could be implemented immediately would be one that returns the raw bytes of the Arrow buffer, to let us identify its contents using [the Arrow spec|[https://github.com/apache/arrow/blob/master/format/Layout.md].] But that doesn't make use of the dtype (probably just set it to uint8) and would probably make more sense as a raw buffer. (Should that be a separate JIRA ticket?)
|
Converting to a struct array sounds like the reciprocal of ARROW-1886. That doesn't have to be part of a Numpy conversion function, though.
You can use |
Jim Pivarski / @jpivarski: |
Todd Farmer / @toddfarmer: |
There are
to_pandas()
functions, but noto_numpy()
functions. I'd like to propose that we include both.Also,
pyarrow.lib.Array.to_pandas()
returns anumpy.ndarray
, which imho is very confusing :). I think it would be more intuitive for theto_pandas()
functions to returnpandas.Series
andpandas.DataFrame
objects, and theto_numpy()
functions to returnnumpy.ndarray
and either a ordered dict ofnumpy.ndarray
or a structurednumpy.ndarray
depending on a flag, for example. Theto_pandas()
function is of course welcome to use theto_numpy()
func to avoid the additional index and whatnot of thepandas.Series
.Reporter: Lawrence Chan / @llchan
Related issues:
Note: This issue was originally created as ARROW-2295. Please see the migration documentation for further details.
The text was updated successfully, but these errors were encountered: