Pandas DataFrame ‘iat’ Keyword.


Pandas DataFrame ‘iat’ Keyword.

Table Of Contents:

  1. Syntax Of  ‘iat’ Keyword Of Data Frame.
  2. Examples Of  ‘iat’ Keyword.

(1) Syntax:

pandas.DataFrame.iat

Description:

  • Access a single value for a row/column pair by integer position.

  • Here ‘i’ signifies the index of the column.
  • The index always starts with a Zero position.

Raises:

  • IndexError :  When integer position is out of bounds.

(2) Examples Of ‘iat’ Keyword:

Example-1

import pandas as pd
student = {'Name':['Subrat','Abhispa','Arpita','Anuradha','Namita'],
          'Roll_No':[100,101,102,103,104],
          'Subject':['Math','English','Science','History','Commerce'],
          'Mark':[95,88,76,73,93]}
student_object = pd.DataFrame(student)
student_object

Output:

Getting Record At Row ‘1’ And Column ‘Name’

student_object.iat[2,0]

Note:

  • ‘2’ – Represents The Row Index.
  • ‘0’ – Represents The Column Index.

Output:

'Anuradha'

Setting Record At Row ‘2’ And Column ‘Name’

student_object.iat[2,0] = 'Anuradha'
student_object

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *