Skip to content

Int Index.slice_locs Not Raising with Float Arguments #20915

Closed
@WillAyd

Description

@WillAyd

xref #4892 as I'm going through #20812 I am seeing tests which suggest that trying to call slice_locs with float arguments against an integer type Index should raise a TypeError:

pytest.raises(TypeError,

While these tests are currently passing, I believe the TypeError is getting raised from the call to pytest.raises (specifically a 'list' object is not callable for the third argument to pytest.raises) and not as a result of the actual index.slice_locs call.

>>> pd.__version__
'0.23.0.dev0+824.gc4da79b5b.dirty'
>>> index = pd.Index(np.array([0, 1, 2, 5, 6, 7, 9, 10], dtype=int))
>>> index.slice_locs(5.0, 10.0)
(3, 8)
>>> index.slice_locs(4.5, 10.5)
(3, 8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions