Skip to content

Float64 converted Int64 values are roundedoff due to None #57313

@arunkumaralagesan

Description

@arunkumaralagesan

Research

  • I have asked my usage related question on StackOverflow.

  • I have searched the [pandas] tag on StackOverflow for similar questions.

Link to question on StackOverflow

https://stackoverflow.com/questions/53327973/pandas-converting-null-int64-to-float64

Question about pandas

Hi,
I created a df with BigInt's and a single None value. Post conversion when i try to access the entries, the bigint numbers are overflowed and i could not get back the original value as it is. Even after typecasting, using Decimal package etc.

Code:

import pandas as pd
rounded_or_scientific_df = pd.DataFrame({
    'col1': [6760925268837314560, 6947311761343549440, 7103057685633208320, 6844033375485878447, 6844033375485878272, 
             6844033375485878550, 6944033375485878550, None],
})

expected_df = pd.DataFrame({
    'col1': [6760925268837314560, 6947311761343549440, 7103057685633208320, 6844033375485878447, 6844033375485878272, 
             6844033375485878550, 6944033375485878550],
})

The difference is the insertion of None.

Please refer the google collab playground.
Thanks in advance!
Screenshot 2024-02-09 at 2 27 24 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closing CandidateMay be closeable, needs more eyeballsDuplicate ReportDuplicate issue or pull requestMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateUsage Question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions