.at[] और .iat[]
at और iat exactly एक cell पढ़ते या लिखते हैं, और इस काम के लिए ये loc और iloc से faster हैं।
In this page:
Syntax
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[]
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. #}
आम गलतियां
- कई cells select करने की कोशिश करना
- labels और positions mix करना
- जब एक 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: