← Back to Pandas Course | Chapter 4: Indexing & Selection | Lesson 4 of 7

.at[] और .iat[]

at और iat exactly एक cell पढ़ते या लिखते हैं, और इस काम के लिए ये loc और iloc से faster हैं।

In this page:

  1. .at[] और .iat[]
Syntax
python
df.at[row_label, column_label]
df.iat[row_position, column_position]

.at[] और .iat[]

at labels इस्तेमाल करता है: df.at[row_label, col_label]। iat positions इस्तेमाल करता है: df.iat[row_pos, col_pos]। ये सिर्फ एक single scalar handle करते हैं, जो इन्हें general indexers से तेज़ बनाता है।

Note: ऐसे loops के अंदर at और iat इस्तेमाल करें जो single cells update करते हैं।

उदाहरण: .at[] and .iat[]

python
import pandas as pd

df = pd.DataFrame({"score": [70, 85]}, index=["ann", "bob"])
print(df.at["bob", "score"])
print(df.iat[0, 0])
df.at["ann", "score"] = 99
print(df)

# Output:
# 85
# 70
#      score
# ann     99
# bob     85
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. कई cells select करने की कोशिश करना
  2. labels और positions mix करना
  3. जब एक vectorized update काफी होता इन्हें इस्तेमाल करना
चैप्टर सारांश
  • at एक label-based scalar accessor है
  • iat position-based है
  • दोनों एक cell target करते हैं
  • loc और iloc से faster
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.