Repository navigation
GH-51696: Remove stale float16 guard in from_dataframe - #53727
Closed
Asthenia0412 wants to merge 1 commit into
Closed
Asthenia0412 wants to merge 1 commit into
Asthenia0412 wants to merge 1 commit into
Conversation
The guard rejecting float16 columns with NaN values was added because pc.is_nan didn't have a float16 kernel at the time. PR apache#46866 (apacheGH-45083) later added that kernel, making this guard obsolete. Removing the guard allows pandas float16 DataFrames to be imported via from_dataframe() properly. Also update test_pandas_to_pyarrow_float16_with_missing to verify the correct behavior instead of expecting NotImplementedError.
rok
reviewed
Oct 14, 2026
| @@ -319,14 +319,13 @@ def test_pandas_to_pyarrow_with_missing(np_float_str): | |||
|
|
|||
| @pytest.mark.pandas | |||
| def test_pandas_to_pyarrow_float16_with_missing(): | |||
Member
There was a problem hiding this comment.
Perhaps it's better to just removetest_pandas_to_pyarrow_float16_with_missing test and make sure pc.is_nan on float16 is tested where all other types are tested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
A stale guard in
from_dataframe.pyrejects pandas float16 columns with NaN values, claimingpc.is_nanhas no float16 kernel.Problem
Every
from_dataframe()call with a float16 DataFrame raisesNotImplementedError.Solution
Removed the outdated guard block. PR #46866 already added float16 support to
pc.is_nan(GH-45083), so float16 now flows through the same code path as other float widths.Testing
Verified that
from_dataframe(pd.DataFrame({'h': np.array([1.5, np.nan], dtype='<f2')}))now succeeds and produces a table with correct null handling.Also updated the existing test
test_pandas_to_pyarrow_float16_with_missingto verify correct behavior instead of expectingNotImplementedError.