Skip to content

Bounds checks for IntegerArray #21796

@TomAugspurger

Description

@TomAugspurger

On the current PR there are a couple "issues" with handling out of bounds values.

This follows NumPy's behavior, but is maybe not what the user wants

In [18]: pd.core.arrays.IntegerArray([-1, 2, 3], dtype=pd.core.arrays.integer.UInt16Dtype)
Out[18]: IntegerArray([65535, 2, 3], dtype='UInt16')
In [19]: x = pd.core.arrays.IntegerArray([-1, 2, 3], dtype=pd.core.arrays.integer.UInt16Dtype)

In [20]: x[0] = -1

In [21]: x
Out[21]: IntegerArray([65535, 2, 3], dtype='UInt16')

These could perhaps raise a ValueError instead.

xref #21160

Metadata

Metadata

Assignees

Labels

NA - MaskedArraysRelated to pd.NA and nullable extension arraysNeeds TestsUnit test(s) needed to prevent regressionsgood first issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions