Skip to content

Commit 9252308

Browse files
author
tp
committed
moved tests from TestAnnual to TestPivotTable
1 parent 9310f0f commit 9252308

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas/tests/reshape/test_pivot.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,24 @@ def test_pivot_dtaccessor(self):
890890
index=['X', 'Y'], columns=exp_col)
891891
tm.assert_frame_equal(result, expected)
892892

893+
def test_daily(self):
894+
rng = date_range('1/1/2000', '12/31/2004', freq='D')
895+
ts = Series(np.random.randn(len(rng)), index=rng)
896+
897+
annual = pivot_table(DataFrame(ts), index=ts.index.year,
898+
columns=ts.index.dayofyear)
899+
annual.columns = annual.columns.droplevel(0)
900+
901+
doy = np.asarray(ts.index.dayofyear)
902+
903+
for i in range(1, 367):
904+
subset = ts[doy == i]
905+
subset.index = [x.year for x in subset.index]
906+
907+
result = annual[i].dropna()
908+
tm.assert_series_equal(result, subset, check_names=False)
909+
assert result.name == i
910+
893911
def test_pivot_table_with_iterator_values(self):
894912
# GH 12017
895913
aggs = {'D': 'sum', 'E': 'mean'}

0 commit comments

Comments
 (0)