Opening the book…
I mentioned above the eternal truth that each row of a DataFrame is a Series. Once you grasp this, you’ll realize that you can access an individual “cell” of a DataFrame simply by getting the row you want, and then getting the specific value from that. A two-step process for doing this would be:
Code \(\PageIndex{1}\) (Python):
lisas_row = simpsons.loc['Lisa']
lisas_iq = lisas_row['IQ']
print(lisas_iq)
But a shorter, one-stepper just combines these two operations on the same line:
Code \(\PageIndex{2}\) (Python):
lisas_iq = simpsons.loc['Lisa']['IQ']
print(lisas_iq)
This page titled 17.2: Accessing Individual Elements was last modified on Sun, 18 Sep 2022 02:06:16 GMT and is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Stephen Davies (allthemath.org) via source content that was edited to the style and standards of the LibreTexts platform.
The book could not be loaded just now.