Skip to content

BUG: to_numeric doesn't work uint64 numbers #14422

Closed
@verhalenn

Description

@verhalenn

uint64 isn't very well supported right now but something to consider.

In [10]: pd.to_numeric(pd.Series([0, 9223372036854775808]), downcast = 'unsigned')
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
<ipython-input-10-6e8272095758> in <module>()
----> 1 pd.to_numeric(pd.Series([0, 9223372036854775808]), downcast = 'unsigned')

/home/verhalenn/Documents/Open-Source/pandas/pandas/tools/util.py in to_numeric(arg, errors, downcast)
    193             coerce_numeric = False if errors in ('ignore', 'raise') else True
    194             values = lib.maybe_convert_numeric(values, set(),
--> 195                                                coerce_numeric=coerce_numeric)
    196 
    197     except Exception:

/home/verhalenn/Documents/Open-Source/pandas/pandas/src/inference.pyx in pandas.lib.maybe_convert_numeric (pandas/lib.c:53043)()
    667             seen_float = True
    668         elif util.is_integer_object(val):
--> 669             floats[i] = ints[i] = val
    670             seen_int = True
    671         elif util.is_bool_object(val):

OverflowError: Python int too large to convert to C long

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions