File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -7023,6 +7023,8 @@ def append(
7023
7023
"""
7024
7024
if isinstance (other , (Series , dict )):
7025
7025
if isinstance (other , dict ):
7026
+ if not ignore_index :
7027
+ raise TypeError ("Can only append a dict if ignore_index=True" )
7026
7028
other = Series (other )
7027
7029
if other .name is None and not ignore_index :
7028
7030
raise TypeError (
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ def test_append_series_dict(self):
50
50
)
51
51
tm .assert_frame_equal (result , expected .loc [:, result .columns ])
52
52
53
+ msg = "Can only append a dict if ignore_index=True"
54
+ with pytest .raises (TypeError , match = msg ):
55
+ df .append (series .to_dict ())
56
+
53
57
# can append when name set
54
58
row = df .loc [4 ]
55
59
row .name = 5
You can’t perform that action at this time.
0 commit comments