Skip to content

Assignment to uint series drops datatype #18311

Closed
@jeremywhelchel

Description

@jeremywhelchel

Assigning a uint value to a slice of a uint series results in a dataframe of type int.

s = pd.Series([1,2,3], dtype='uint64') # Also happens with other uint dtypes
s.loc[0] = 4
s

With Pandas 0.19.2, this returns:

0    4
1    2
2    3
dtype: uint64

With version 0.21.0, the dtype gets lost and replaced with int64:

0    4
1    2
2    3
dtype: int64

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