Skip to content

Documentation for .iloc is misleadingly incomplete #8956

Closed
@cswarth

Description

@cswarth

The documentation for .loc at http://pandas.pydata.org/pandas-docs/version/0.15.1/indexing.html#different-choices-for-indexing should mention that .iloc also takes a boolean array instead of insisting that it is "strictly integer position based".

.iloc is strictly integer position based (from 0 to length-1 of the axis), will raise IndexError if an indexer is requested and it is out-of-bounds, except slice indexers which allow out-of-bounds indexing. (this conforms with python/numpy slice semantics). Allowed inputs are:

An integer e.g. 5
A list or array of integers [4, 3, 0]
A slice object with ints 1:7

Unlike .loc immediately above, no mention is made of "A boolean array"
This is incorrect as later in the same document an example uses .iloc and isin to retrieve elements from a Series. isin returns a list of booleans (well, strictly it is a numpy.ndarray, but converting to a list works as well)

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsIndexingRelated 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