Skip to content

Commit ae95e89

Browse files
author
Kristian Holsheimer
committed
Updated test: Added github issue id and used 'tm' instead of 'pd.util.testing'
1 parent 1e30ac7 commit ae95e89

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

pandas/tests/frame/test_analytics.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,12 +2262,18 @@ def test_series_nat_conversion(self):
22622262
tm.assert_frame_equal(result, expected)
22632263

22642264
def test_multiindex_column_lookup(self):
2265+
# Check whether tuples are correctly treated as multi-level lookups.
2266+
# GH 23033
22652267
df = pd.DataFrame(
22662268
columns=pd.MultiIndex.from_product([['x'], ['a', 'b']]),
22672269
data=[[0.33, 0.13], [0.86, 0.25], [0.25, 0.70], [0.85, 0.91]])
2268-
pd.util.testing.assert_frame_equal(
2269-
df.nsmallest(3, ('x', 'a')),
2270-
df.iloc[[2, 0, 3]])
2271-
pd.util.testing.assert_frame_equal(
2272-
df.nlargest(3, ('x', 'b')),
2273-
df.iloc[[3, 2, 1]])
2270+
2271+
# nsmallest
2272+
result = df.nsmallest(3, ('x', 'a'))
2273+
expected = df.iloc[[2, 0, 3]]
2274+
tm.assert_frame_equal(result, expected)
2275+
2276+
# nlargest
2277+
result = df.nlargest(3, ('x', 'b'))
2278+
expected = df.iloc[[3, 2, 1]]
2279+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)