|
36 | 36 | _integer2 = DataFrame(np.random.randint(1, 100, size=(101, 4)),
|
37 | 37 | columns=list('ABCD'), dtype='int64')
|
38 | 38 |
|
39 |
| - |
40 | 39 | with catch_warnings(record=True):
|
41 | 40 | _frame_panel = Panel(dict(ItemA=_frame.copy(),
|
42 | 41 | ItemB=(_frame.copy() + 3),
|
@@ -443,18 +442,15 @@ def test_bool_ops_warn_on_arithmetic(self):
|
443 | 442 | e = fe(df, True)
|
444 | 443 | tm.assert_frame_equal(r, e)
|
445 | 444 |
|
446 |
| - def test_bool_ops_column_name_dtype(self): |
| 445 | + def test_has_bool_ops_column_name_dtype(self, eq, ne): |
447 | 446 | # GH 22383 - .ne fails if columns containing column name 'dtype'
|
448 | 447 | df_has_error = DataFrame([[0, 1, 2, 'aa'], [0, 1, 2, 'aa'],
|
449 | 448 | [0, 1, 5, 'bb'], [0, 1, 5, 'bb'],
|
450 | 449 | [0, 1, 5, 'bb'], ['cc', 4, 4, 4]],
|
451 | 450 | columns=['a', 'b', 'c', 'dtype'])
|
452 |
| - df = DataFrame([[0, 1, 2, 'aa'], [0, 1, 2, 'aa'], |
453 |
| - [0, 1, 5, 'bb'], [0, 1, 5, 'bb'], |
454 |
| - [0, 1, 5, 'bb'], ['cc', 4, 4, 4]], |
455 |
| - columns=['a', 'b', 'c', 'd']) |
456 |
| - result = df_has_error.loc[:, ['a', 'dtype']].ne(df_has_error.loc[:, |
457 |
| - ['a', 'dtype']]) |
458 |
| - assert_frame_equal(result, |
459 |
| - df.loc[:, ['a', 'd']].ne(df.loc[:, ['a', 'd']]). |
460 |
| - rename({'d': 'dtype'}, axis=1)) |
| 451 | + expected = DataFrame([[False, False], [False, False], |
| 452 | + [False, False], [False, False]], |
| 453 | + columns=["a", "dtype"]) |
| 454 | + assert_frame_equal(expected, |
| 455 | + df_has_error.loc[:, ['a', 'dtype']]. |
| 456 | + ne(df_has_error.loc[:, ['a', 'dtype']])) |
0 commit comments