Indexing

Used to query an element or subset of a Series or Dataframe or lazyframe.

There are four main indexing kinds in Polars:

Types
API
Meaning
Get one Item of Series.get methodGet a single element
Integer index.take methodGiven a number of integer index values, a subset of Series/Dataframe/lazyframe is returned for rows or columns
Name index.select and .column methodGiven the column name, a subset of Dataframe/lazyframe is returned.
Slice index.slice methodGiven a slice, a subset within the slice range is returned;
bool index.filter methodGiven a bool array as an index, it must be consistent with the number of container elements, and return a subset of elements corresponding to true.

The API is also designed according to the above 4 types. See Indexing Series,Get one item of Series, Indexing dataframe, Indexing LazyFrame