Skip to content

Commit

Permalink
TST: raising ValueError when inserting one dataframe in another (#42831)
Browse files Browse the repository at this point in the history
* TST: raising ValueError when inserting one dataframe in another

* added GH issue reference

* rev msg

* included both msgs

* updated

* Update test_insert.py

* Update test_insert.py

* Update test_insert.py
  • Loading branch information
debnathshoham authored Aug 5, 2021
1 parent 6ef154e commit e045034
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pandas/tests/frame/indexing/test_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,13 @@ def test_insert_item_cache(self, using_array_manager):
ser.values[0] = 99

assert df.iloc[0, 0] == df[0][0]

def test_insert_frame(self):
# GH#42403
df = DataFrame({"col1": [1, 2], "col2": [3, 4]})
msg = (
"Expected a 1D array, got an array with shape "
r"\(2, 2\)|Wrong number of items passed 2, placement implies 1"
)
with pytest.raises(ValueError, match=msg):
df.insert(1, "newcol", df)

0 comments on commit e045034

Please sign in to comment.