Skip to content

Commit 1409049

Browse files
committed
Merge pull request #4813 from jreback/dup_resample
TST: tests for GH4812 (already fixed in master)
2 parents 6d3fb3f + 0b8f7de commit 1409049

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tseries/tests/test_resample.py

+11
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,17 @@ def test_resample_ohlc_dataframe(self):
284284
# dupe columns fail atm
285285
# df.columns = ['PRICE', 'PRICE']
286286

287+
def test_resample_dup_index(self):
288+
289+
# GH 4812
290+
# dup columns with resample raising
291+
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) ])
292+
df.iloc[3,:] = np.nan
293+
result = df.resample('Q',axis=1)
294+
expected = df.groupby(lambda x: int((x.month-1)/3),axis=1).mean()
295+
expected.columns = [ Period(year=2000,quarter=i+1,freq='Q') for i in range(4) ]
296+
assert_frame_equal(result, expected)
297+
287298
def test_resample_reresample(self):
288299
dti = DatetimeIndex(
289300
start=datetime(2005, 1, 1), end=datetime(2005, 1, 10),

0 commit comments

Comments
 (0)