Skip to content

Glossary: pandas Basics

set_index

Also written: .set_index()

Makes a column into the index, so row labels differ from positions. After it, `.loc` and `.iloc` give different answers.

Where the book teaches it

Related terms

Indexlociloc