def _test_stack_with_multiindex(multiindex):
    df = DataFrame(np.arange((3 * len(multiindex))).reshape(3, len(multiindex)), columns=multiindex)
    for level in ((- 1), 0, 1, [0, 1], [1, 0]):
        result = df.stack(level=level, dropna=False)
        if isinstance(level, int):
            expected = df.stack(level=level, dropna=True)
            if isinstance(expected, Series):
                assert_series_equal(result, expected)
            else:
                assert_frame_equal(result, expected)
        df.columns = MultiIndex.from_tuples(df.columns.get_values(), names=df.columns.names)
        expected = df.stack(level=level, dropna=False)
        if isinstance(expected, Series):
            assert_series_equal(result, expected)
        else:
            assert_frame_equal(result, expected)
def _test_stack_with_multiindex(multiindex):
    df = DataFrame(np.arange((3 * len(multiindex))).reshape(3, len(multiindex)), columns=multiindex)
    for level in ((- 1), 0, 1, [0, 1], [1, 0]):
        result = df.stack(level=level, dropna=False)
        if isinstance(level, int):
            expected = df.stack(level=level, dropna=True)
            if isinstance(expected, Series):
                assert_series_equal(result, expected)
            else:
                assert_frame_equal(result, expected)
        df.columns = MultiIndex.from_tuples(df.columns.get_values(), names=df.columns.names)
        expected = df.stack(level=level, dropna=False)
        if isinstance(expected, Series):
            assert_series_equal(result, expected)
        else:
            assert_frame_equal(result, expected)