Skip to content

BUG: maybe_convert_numeric fails with uint64 #14982

Closed
@gfyoung

Description

@gfyoung

master at aba7d2:

>>> from pandas import lib, np
>>> arr = np.array([2**63], dtype=object)
>>> lib.maybe_convert_numeric(arr, set())
...
OverflowError: Python int too large to convert to C long

At first, I thought the patch would be similar to #14916, but there are several complications here:

  • Handling an array with negative and uint64 values: in maybe_convert_objects, we would just return object to avoid data truncation. However, this function currently only returns numeric arrays. And if we do decide to return non-numeric, should we then raise if coerce_numeric=True then?
  • uint64 has no convenient na_value, so what happens if a uint64 is in na_values?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions