@@ -2060,8 +2060,23 @@ def test_getitem_ndim2(self):
2060
2060
idx = period_range ('2007-01' , periods = 3 , freq = 'M' )
2061
2061
2062
2062
result = idx [:, None ]
2063
- # MPL kludge
2063
+ # MPL kludge, internally has incorrect shape
2064
2064
tm .assertIsInstance (result , PeriodIndex )
2065
+ self .assertEqual (result .shape , (len (idx ), 1 ))
2066
+
2067
+ def test_getitem_index (self ):
2068
+ idx = period_range ('2007-01' , periods = 10 , freq = 'M' , name = 'x' )
2069
+
2070
+ result = idx [[1 , 3 , 5 ]]
2071
+ exp = pd .PeriodIndex (['2007-02' , '2007-04' , '2007-06' ],
2072
+ freq = 'M' , name = 'x' )
2073
+ tm .assert_index_equal (result , exp )
2074
+
2075
+ result = idx [[True , True , False , False , False ,
2076
+ True , True , False , False , False ]]
2077
+ exp = pd .PeriodIndex (['2007-01' , '2007-02' , '2007-06' , '2007-07' ],
2078
+ freq = 'M' , name = 'x' )
2079
+ tm .assert_index_equal (result , exp )
2065
2080
2066
2081
def test_getitem_partial (self ):
2067
2082
rng = period_range ('2007-01' , periods = 50 , freq = 'M' )
0 commit comments