Skip to content

BUG: pd.to_numeric(..., downcast='unsigned') should accept 0 #14401

Closed
@jreback

Description

@jreback

with 0.19.0.

In [28]: pd.to_numeric(pd.Series([1,2,3]), downcast='unsigned')
Out[28]: 
0    1
1    2
2    3
dtype: uint8

In [29]: pd.to_numeric(pd.Series([0,1,2,3]), downcast='unsigned')
Out[29]: 
0    0
1    1
2    2
3    3
dtype: int64
In [30]: np.iinfo(np.uint8).min
Out[30]: 0

I think 0 is a legit uint8, so [29] should be uint8.

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