Skip to content

BUG: DataFrame.at allows adding new rows to a DataFrame #48323

Open
@rhshadrach

Description

@rhshadrach
df = pd.DataFrame({'a': [1, 2]})
df.at[5, 'a'] = 6
print(df)

#      a
# 0  1.0
# 1  2.0
# 5  6.0

The docstring of DataFrame.at says this should raise a KeyError. This method shouldn't allow the addition of rows because it is ill-performant and makes .at both an indexing and reshaping method.

This may be related to #48224, but seems to me to be a separate issue (at least, from a user perspective).

Metadata

Metadata

Assignees

Labels

DeprecateFunctionality to remove in pandasIndexingRelated to indexing on series/frames, not to indexes themselves

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions