Skip to content

Commit

Permalink
moved tests from TestAnnual to TestPivotTable
Browse files Browse the repository at this point in the history
  • Loading branch information
tp committed Nov 20, 2017
1 parent 9310f0f commit 9252308
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pandas/tests/reshape/test_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,24 @@ def test_pivot_dtaccessor(self):
index=['X', 'Y'], columns=exp_col)
tm.assert_frame_equal(result, expected)

def test_daily(self):
rng = date_range('1/1/2000', '12/31/2004', freq='D')
ts = Series(np.random.randn(len(rng)), index=rng)

annual = pivot_table(DataFrame(ts), index=ts.index.year,
columns=ts.index.dayofyear)
annual.columns = annual.columns.droplevel(0)

doy = np.asarray(ts.index.dayofyear)

for i in range(1, 367):
subset = ts[doy == i]
subset.index = [x.year for x in subset.index]

result = annual[i].dropna()
tm.assert_series_equal(result, subset, check_names=False)
assert result.name == i

def test_pivot_table_with_iterator_values(self):
# GH 12017
aggs = {'D': 'sum', 'E': 'mean'}
Expand Down

0 comments on commit 9252308

Please sign in to comment.