O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Selecting values using an index

Values can be looked up using an index using the [] operator or by using the following property indexers of a Series or DataFrame:

.loc[]

Looks up by the label, not the location. But be careful; if the labels are integers, then integers will be treated as labels!

.at[]

Like .loc[], but this can only retrieve a single value.

.iloc[]

Lookup is based on the 0-based position and not the index label.

.ix[]

Hybrid, which when given an integer will attempt 0-based lookup; other types are label-based. This is going to be deprecated, so stick with the other three properties.

Values can be looked up in a Series by using the [] operator as in the following DataFrame, which has its b value retrieved. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required