This repository was archived by the owner on Mar 13, 2026. It is now read-only.
fix: handle None when converting numerics to parquet#768
Merged
Conversation
chalmerlowe
reviewed
May 15, 2024
| # decimal.Decimal does not support `None` input, add support here. | ||
| # https://github.com/googleapis/python-bigquery-pandas/issues/719 | ||
| def convert(x): | ||
| if x is None: |
Contributor
There was a problem hiding this comment.
QUESTION:
The original issue mentions that None and pd.NA are not handled appropriately.
This code seems to only address None.
Is the intent to check for both?
IF yes... this may be a possible check that is more general AND as other edge cases arise could enable edits to the code quickly and easily.
Suggested change
| if x is None: | |
| if x in {None, pd.NA}: |
Contributor
Author
There was a problem hiding this comment.
Indeed, thank you for catching this! I'll update the code.
chalmerlowe
reviewed
May 15, 2024
chalmerlowe
approved these changes
May 29, 2024
chalmerlowe
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thanks for adding the extra test case.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
decimal.Decimalreports an error when the input isNone. This PR adds a lambda func to handle this case, as well as a unit test.Fixes #719 🦕