polars.DataFrame.find_idx_by_name#

DataFrame.find_idx_by_name(name: str) int[source]#

Find the index of a column by name.

Parameters:
name

Name of the column to find.

Examples

>>> df = pl.DataFrame(
...     {"foo": [1, 2, 3], "bar": [6, 7, 8], "ham": ["a", "b", "c"]}
... )
>>> df.find_idx_by_name("ham")
2