BUG: Precision loss when casting 19-digit integer to float #43979
Labels
Bug
Constructors
Series/DataFrame/Index/pd.array Constructors
Dtype Conversions
Unexpected or buggy dtype conversions
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
When a series is created from a list that contains np.nan values, its type is float.
And if the list contains 19-digit integers the precision of the last few digits is lost.
A similar issue seems to have been fixed in numpy a couple of years ago: numpy/numpy#9006.
Would you please suggest any workaround until this is resolved? Having a series with integer values and nans would work for me in this particular case. Thank you in advance.
Expected Behavior
The expected behaviour would be to keep the precision exactly.
Installed Versions
INSTALLED VERSIONS
commit : 73c6825
python : 3.8.5.final.0
pandas : 1.3.3
numpy : 1.20.2
The text was updated successfully, but these errors were encountered: