modin.pandas.Series.iloc¶
- property Series.iloc: _iLocIndexer[source]¶
Purely integer-location based indexing for selection by position.
.iloc[]is primarily integer position based (from0tolength-1of the axis), but may also be used with a boolean array.Allowed inputs are:
An integer, e.g.
5,-1.A list or array of integers, e.g.
[4, 3, 0].A slice object with ints, e.g.
1:7.A boolean array.
A
callablefunction with one argument (the calling Series or DataFrame) and that returns valid output for indexing (one of the above). This is useful in method chains, when you don’t have a reference to the calling object, but would like to base your selection on some value.A tuple of row and column indexes. The tuple elements consist of one of the above inputs, e.g.
(0, 1).
Notes
To meet the nature of lazy evaluation:
Snowpark pandas
.ilocignores out-of-bounds indexing for all types of indexers (while pandas.ilocwill raise error except slice indexer). If all values are out-of-bound, an empty result will be returned.In Snowpark pandas
.iloc, the length of boolean list-like indexers (e.g., list, Series, Index, numpy ndarray) does not need to be the same length as the row/column being indexed. Internally a join is going to be performed so missing or out of bound values will be ignored.
See also
DataFrame.iatFast integer location scalar accessor.
DataFrame.locPurely label-location based indexer for selection by label.
Series.ilocPurely integer-location based indexing for selection by position.
Examples
Indexing just the rows
With a scalar integer.
With a list of integers.
With out-of-bound values in the list and those out of bound values will be ignored.
With all out-of-bound values. Return empty dataset.
With a slice object.
With a boolean mask the same length as the index.
When a boolean mask shorter than the index.
When a boolean mask longer than the index.
With a callable, useful in method chains. The x passed to the
lambdais the DataFrame being sliced. This selects the rows whose index labels are even.Indexing both axes
You can mix the indexer types for the index and columns. Use
:to select the entire axis.With scalar integers.
With lists of integers.
With slice objects.
With a boolean array whose length matches the columns.
With a callable function that expects the Series or DataFrame.