#NEWLINE# def test_take( self ) : #NEWLINE# #INDENT# idx1 = pd . period_range ( '2011-01-01' , '2011-01-31' , freq = 'D' , name = 'idx' ) #NEWLINE# for idx in [ idx1 ] : #NEWLINE# #INDENT# result = idx . take ( [ 0 ] ) #NEWLINE# self . assertEqual ( result , pd . Period ( '2011-01-01' , freq = 'D' ) ) #NEWLINE# result = idx . take ( [ 5 ] ) #NEWLINE# self . assertEqual ( result , pd . Period ( '2011-01-06' , freq = 'D' ) ) #NEWLINE# result = idx . take ( [ 0 , 1 , 2 ] ) #NEWLINE# expected = pd . period_range ( '2011-01-01' , '2011-01-03' , freq = 'D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , 'D' ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# result = idx . take ( [ 0 , 2 , 4 ] ) #NEWLINE# expected = pd . PeriodIndex ( [ '2011-01-01' , '2011-01-03' , '2011-01-05' ] , freq = 'D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# self . assertEqual ( result . freq , 'D' ) #NEWLINE# result = idx . take ( [ 7 , 4 , 1 ] ) #NEWLINE# expected = pd . PeriodIndex ( [ '2011-01-08' , '2011-01-05' , '2011-01-02' ] , freq = 'D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# self . assertEqual ( result . freq , 'D' ) #NEWLINE# result = idx . take ( [ 3 , 2 , 5 ] ) #NEWLINE# expected = PeriodIndex ( [ '2011-01-04' , '2011-01-03' , '2011-01-06' ] , freq = 'D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# self . assertEqual ( result . freq , 'D' ) #NEWLINE# result = idx . take ( [ ( - 3 ) , 2 , 5 ] ) #NEWLINE# expected = PeriodIndex ( [ '2011-01-29' , '2011-01-03' , '2011-01-06' ] , freq = 'D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# self . assertEqual ( result . freq , 'D' )