You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspdimportnumpyasnpprint(pd.array([23842938553820651, np.nan], dtype=pd.Int64Dtype())) # from the docsprint()
print(pd.array([23842938553820651, pd.NaT], dtype=pd.Int64Dtype()))
The integers are converted to float before casting to the new Nullable integer, so they lose precision anyway (which is the the most usual reason for using them, as stated in the docs). Using the native pd.NaT solves the problem.
Uh oh!
There was an error while loading. Please reload this page.
Code Sample
Problem description
Examples in the documentation of Nullable integers don't work as expected https://pandas.pydata.org/pandas-docs/stable/user_guide/integer_na.html
The integers are converted to float before casting to the new Nullable integer, so they lose precision anyway (which is the the most usual reason for using them, as stated in the docs). Using the native pd.NaT solves the problem.
Expected Output
Output of code sample
Output of pd.show_versions()
The text was updated successfully, but these errors were encountered: