Skip to content

Commit 39286fd

Browse files
rhshadrachnoatamir
authored andcommitted
BUG: Add note in whatsnew for DataFrame.at behavior change (pandas-dev#48324)
1 parent aaae529 commit 39286fd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/source/whatsnew/v1.5.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ Indexing
10821082
- Bug in :meth:`DataFrame.sum` min_count changes dtype if input contains NaNs (:issue:`46947`)
10831083
- Bug in :class:`IntervalTree` that lead to an infinite recursion. (:issue:`46658`)
10841084
- Bug in :class:`PeriodIndex` raising ``AttributeError`` when indexing on ``NA``, rather than putting ``NaT`` in its place. (:issue:`46673`)
1085-
-
1085+
- Bug in :meth:`DataFrame.at` would allow the modification of multiple columns (:issue:`48296`)
10861086

10871087
Missing
10881088
^^^^^^^

pandas/tests/indexing/test_at.py

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import numpy as np
77
import pytest
88

9+
from pandas.errors import InvalidIndexError
10+
911
from pandas import (
1012
CategoricalDtype,
1113
CategoricalIndex,
@@ -206,6 +208,12 @@ def test_at_frame_raises_key_error2(self, indexer_al):
206208
with pytest.raises(KeyError, match="^0$"):
207209
indexer_al(df)["a", 0]
208210

211+
def test_at_frame_multiple_columns(self):
212+
# GH#48296 - at shouldn't modify multiple columns
213+
df = DataFrame({"a": [1, 2], "b": [3, 4]})
214+
with pytest.raises(InvalidIndexError, match=r"slice\(None, None, None\)"):
215+
df.at[5] = [6, 7]
216+
209217
def test_at_getitem_mixed_index_no_fallback(self):
210218
# GH#19860
211219
ser = Series([1, 2, 3, 4, 5], index=["a", "b", "c", 1, 2])

0 commit comments

Comments
 (0)