-
Notifications
You must be signed in to change notification settings - Fork 3.7k
GH-46611: [Python][C++] Allow building float16 arrays without numpy #46618
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
base: main
Are you sure you want to change the base?
Conversation
@WillAyd @pitrou what would be your expectation here:
|
I agree a Python |
Co-authored-by: Antoine Pitrou <[email protected]>
@@ -87,15 +86,18 @@ NPY_INT_DECL(ULONGLONG, UInt64, uint64_t); | |||
|
|||
template <> | |||
struct npy_traits<NPY_FLOAT16> { | |||
typedef npy_half value_type; | |||
typedef uint16_t value_type; |
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.
Note this could also be arrow::util::Float16
, if that's easy to do.
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 requiring quite a lot of changes around pyarrow/src/arrow/python/python_to_arrow.cc
, pyarrow/src/arrow/python/arrow_to_pandas.cc
and haven't been able to make it work yet. I would prefer to explore updating it on a different issue
Co-authored-by: Antoine Pitrou <[email protected]>
Rationale for this change
When we added Float16 we did not update pyarrow to be able to convert from Python objects to Arrow. Float16 required numpy and it crashed if numpy was not present.
What changes are included in this PR?
Allow to not require numpy to generate float16 scalars and arrays on pyarrow and do not fail if numpy is not present.
Are these changes tested?
Yes, new tests have been added
Are there any user-facing changes?
No changes for old functionality. Users will be allowed to use float16 without requiring to use np.float16 and directly from Python objects