diff --git a/pandas/tseries/tests/test_resample.py b/pandas/tseries/tests/test_resample.py index 1c6c4eae8d279..6ad69a466ba03 100644 --- a/pandas/tseries/tests/test_resample.py +++ b/pandas/tseries/tests/test_resample.py @@ -284,6 +284,17 @@ def test_resample_ohlc_dataframe(self): # dupe columns fail atm # df.columns = ['PRICE', 'PRICE'] + def test_resample_dup_index(self): + + # GH 4812 + # dup columns with resample raising + df = DataFrame(np.random.randn(4,12),index=[2000,2000,2000,2000],columns=[ Period(year=2000,month=i+1,freq='M') for i in range(12) ]) + df.iloc[3,:] = np.nan + result = df.resample('Q',axis=1) + expected = df.groupby(lambda x: int((x.month-1)/3),axis=1).mean() + expected.columns = [ Period(year=2000,quarter=i+1,freq='Q') for i in range(4) ] + assert_frame_equal(result, expected) + def test_resample_reresample(self): dti = DatetimeIndex( start=datetime(2005, 1, 1), end=datetime(2005, 1, 10),