Skip to content

REGR: Adding a row via DataFrame.at #48296

Closed
@rhshadrach

Description

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

On 1.4.x, this gives

     a    b
0  1.0  3.0
1  2.0  4.0
2  5.0  6.0

whereas on 1.5.0rc0 it gives pandas.errors.InvalidIndexError: slice(None, None, None). I didn't any mention of this in the whatsnew, and a git bisect points at #47074; cc @jorisvandenbossche.

The docs of DataFrame.at explicitly say a KeyError is raised when the label is not in the frame. It seems to me this operation should not be supported, and can be considered a bugfix, but would be better to raise KeyError: label 2 not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselvesNeeds TestsUnit test(s) needed to prevent regressionsRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions