We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0b39ea commit f43dbf8Copy full SHA for f43dbf8
pandas/tests/frame/test_mutate_columns.py
@@ -257,3 +257,21 @@ def test_insert_column_bug_4032(self):
257
expected = DataFrame([[1.3, 1, 1.1], [2.3, 2, 2.2]],
258
columns=['c', 'a', 'b'])
259
assert_frame_equal(result, expected)
260
+
261
+ data = [[1, 2, 3], [1, 2, 3]]
262
263
+ @pytest.mark.parametrize('actual', [
264
+ DataFrame(data=data, index=['a', 'a']),
265
+ DataFrame(data=data, index=['a', 'b']),
266
+ DataFrame(data=data, index=['a', 'b']).set_index([0, 1]),
267
+ DataFrame(data=data, index=['a', 'a']).set_index([0, 1])
268
+ ])
269
+ def test_raise_on_drop_duplicate_index(self, actual):
270
271
+ # issue 19186
272
+ level = 0 if isinstance(actual.index, MultiIndex) else None
273
+ with pytest.raises(ValueError):
274
+ actual.drop('c', level=level, axis=0)
275
+ expected_no_err = actual.drop('c', axis=0, level=level,
276
+ errors='ignore')
277
+ assert_frame_equal(expected_no_err, actual)
0 commit comments