Skip to content

Commit ea26053

Browse files
TST: assert indexing with list of Periods works (GH7710)
1 parent 47a8e71 commit ea26053

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tseries/tests/test_period.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,13 @@ def test_getitem_nat(self):
21802180
pd.Period('2011-01', freq='M'))
21812181
self.assertIs(s[pd.NaT], tslib.NaT)
21822182

2183+
def test_getitem_list_periods(self):
2184+
# GH 7710
2185+
rng = period_range(start='2012-01-01', periods=10, freq='D')
2186+
ts = Series(lrange(len(rng)), index=rng)
2187+
exp = ts.iloc[[1]]
2188+
tm.assert_series_equal(ts[[Period('2012-01-02', freq='D')]], exp)
2189+
21832190
def test_slice_with_negative_step(self):
21842191
ts = Series(np.arange(20),
21852192
period_range('2014-01', periods=20, freq='M'))

0 commit comments

Comments
 (0)