Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Pandas · Module

df.iat

DataFrame.iat reads or writes one cell using integer row and column positions. It is the scalar counterpart to broader positional selection with iloc.

How it works

DataFrame.iat is a scalar indexer for accessing or changing one cell by its zero-based row and column positions. Unlike label-based at, it selects by integer position and is intended for single-value operations rather than slices or groups.

Syntax

DataFrame.iat[row, column]

Parameters

NameTypeDescription
row positionintegerInteger position of the row in the DataFrame.
column positionintegerInteger position of the column in the DataFrame.

Returns

The scalar value at the requested row and column position when reading; assignment updates the selected cell and does not produce a separate tabular result.

Key points

  • It selects exactly one DataFrame cell from a row and column coordinate expressed as integer positions.
  • Its positional selection semantics resemble iloc, but its purpose is scalar access rather than selecting groups.
  • Choose it when an operation needs to read or update one value instead of a collection of cells.
  • Reading with two positions returns the value currently stored at that cell.
  • Assignment through the same positional expression changes the selected cell in the DataFrame.
  • After selecting a row as a Series, its iat accessor can retrieve one element by that Series' integer position.

Common mistakes

  • An invalid row or column position raises IndexError, so both integer coordinates must refer to existing positions.

Example: Read and update one cell

import pandas as pd

frame = pd.DataFrame([[10, 20], [30, 40]], columns=["x", "y"])

value = frame.iat[1, 0]
frame.iat[1, 0] = 99

print(value)       # 30
print(frame.iat[1, 0])  # 99

Use integer row and column positions to read one cell, or assign a new value to that cell.

When to use it

Scalar lookup

Read one known cell efficiently during validation or transformation.

In-place scalar update

Replace one cell without selecting a larger slice.

Series element access

Retrieve one element after selecting a row as a Series.

Interview questions

QWhat is DataFrame.iat used for?

iat accesses one DataFrame value using integer row and column positions. It can both retrieve a scalar and assign a replacement value.

Follow-up: How would you access a cell by labels instead? Use DataFrame.at, which performs scalar label-based access.

QHow does iat differ from iloc?

Both iat and iloc use integer-based indexing, but iat is intended for a single value. iloc is the broader positional indexer for groups of rows and columns.

Follow-up: Which accessor is suitable for one value identified by row and column labels? Use at.

QHow are positions supplied to iat?

For a two-dimensional DataFrame, supply the row position first and the column position second, such as df.iat[1, 2]. The positions are integer coordinates, independent of the displayed index and column labels.

Follow-up: What happens when either coordinate exceeds the DataFrame bounds? Pandas raises IndexError.

  • DataFrame.at
  • DataFrame.loc
  • DataFrame.iloc
  • Series.iat

Source: pandas.DataFrame.iat. Checked 2026-10-15.