The .iat and .at operators

The .iat and .at operators are equivalent to .iloc and .loc operators—the former is for position-based indexing and the latter for label-based indexing. While .loc and .iloc support the selection of multiple values, .at and .iat can only extract a single scalar value. Hence they require row and column indices for slicing:

In: df_loc2.at["2012", "Americas"]
Out: 9.0

In: df_loc1.iat[2, 3]
Out: 14.0

The .iat and .at operators are considerably faster in performance than .iloc and .loc:

Benchmarking .iat with respect to .iloc
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset