Skip to content

DOC: check_array_indexer also accepts an int or a slice #62562

@Dr-Irv

Description

@Dr-Irv

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.api.indexers.check_array_indexer.html

Documentation problem

check_array_indexer also takes as input a single int or a slice as an argument for the indexer:

>>> import pandas as pd
>>> arr = pd.array([1, 2])
>>> pd.api.indexers.check_array_indexer(arr, 1)
1
>>> pd.api.indexers.check_array_indexer(arr, slice(0,1,1))
slice(0, 1, 1)

Not clear if this is a doc issue, or if the code should be checking that those arguments are invalid. I think they are valid since in the decimal extension array example, it is used in __setitem__() to check if the indexer is valid.

Suggested fix for documentation

Specify that a single int or slice is valid.

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