From 62f464ff73c4ce3137c896b34613659cdf331075 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Mon, 7 Aug 2017 11:04:07 -0700 Subject: [PATCH] TST: Partial Boolean DataFrame Indexing (#17186) Closes gh-17170 --- pandas/tests/indexing/test_indexing.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pandas/tests/indexing/test_indexing.py b/pandas/tests/indexing/test_indexing.py index 3ecd1f3029cad..f1f51f26df55c 100644 --- a/pandas/tests/indexing/test_indexing.py +++ b/pandas/tests/indexing/test_indexing.py @@ -861,6 +861,20 @@ def test_maybe_numeric_slice(self): expected = [1] assert result == expected + def test_partial_boolean_frame_indexing(self): + # GH 17170 + df = pd.DataFrame(np.arange(9.).reshape(3, 3), + index=list('abc'), + columns=list('ABC')) + index_df = pd.DataFrame(1, index=list('ab'), columns=list('AB')) + result = df[index_df.notnull()] + expected = pd.DataFrame(np.array([[0., 1., np.nan], + [3., 4., np.nan], + [np.nan] * 3]), + index=list('abc'), + columns=list('ABC')) + tm.assert_frame_equal(result, expected) + class TestSeriesNoneCoercion(object): EXPECTED_RESULTS = [