How can I get a value from a cell of a dataframe?
You can use the .at or .iat methods to get the value of a specific cell in a DataFrame.
You can use the .at or .iat methods to get the value of a specific cell in a DataFrame.
Here's an example:
Get a value from a cell of a Pandas DataFrame in Python using the at method
python— editable, runs on the server
Info
Watch a video course: Python - The Practical Guide
You can also use the .iat method if you want to access the cell by its index rather than by its label:
Get a value from a cell of a Pandas DataFrame in Python using the iat method
value = df.iat[0, 0]
print(value)Both .at and .iat will return the value of the cell at the specified row and column.