fix: crash on null values from access long type#5
Open
verasativa wants to merge 1 commit into
Open
Conversation
Changed the conversion from access long type to pandas float instead of pandas int, in order to support null values. Note that pandas just released int null support @ pandas .24, but still experimental.
verasativa
added a commit
to verasativa/defunciones-decoder
that referenced
this pull request
Feb 25, 2019
behrenhoff
reviewed
May 6, 2019
| return np.float_ | ||
| elif data_type.startswith('long'): | ||
| return np.int_ | ||
| # access CAN have null values on long type, @ pandas 0.24 int null suport is experimental, a float is safer for now. |
There was a problem hiding this comment.
float supports a smaller range than INT. This might be ok, but when dealing with IDs (which tend to use up the whole range of values), you will break code.
consider:
f = np.float_(1 << 53)
print(f)
f += 1
print(f)
(in case np.float_ is a 64 bit IEEE representation)
So this should at least be optional.
Author
There was a problem hiding this comment.
Since pandas .24 there is a Int type (notice the caps on the I), which allows nulls ints. If you are willing to require .24+ (they are at .24.2 now), that will fix it for both cases.
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.
Changed the conversion from access long type to pandas float instead of pandas int, in order to support null values.
Note that pandas just released int null support @ pandas .24, but still experimental.