#NEWLINE# def test_sort_index_inplace( self ) : #NEWLINE# #INDENT# frame = DataFrame ( np . random . randn ( 4 , 4 ) , index = [ 1 , 2 , 3 , 4 ] , columns = [ 'A' , 'B' , 'C' , 'D' ] ) #NEWLINE# unordered = frame . ix [ [ 3 , 2 , 4 , 1 ] ] #NEWLINE# a_id = id ( unordered [ 'A' ] ) #NEWLINE# df = unordered . copy ( ) #NEWLINE# df . sort_index ( inplace = True ) #NEWLINE# expected = frame #NEWLINE# assert_frame_equal ( df , expected ) #NEWLINE# self . assertNotEqual ( a_id , id ( df [ 'A' ] ) ) #NEWLINE# df = unordered . copy ( ) #NEWLINE# df . sort_index ( ascending = False , inplace = True ) #NEWLINE# expected = frame [ : : ( - 1 ) ] #NEWLINE# assert_frame_equal ( df , expected ) #NEWLINE# unordered = frame . ix [ : , [ 'D' , 'B' , 'C' , 'A' ] ] #NEWLINE# df = unordered . copy ( ) #NEWLINE# df . sort_index ( axis = 1 , inplace = True ) #NEWLINE# expected = frame #NEWLINE# assert_frame_equal ( df , expected ) #NEWLINE# df = unordered . copy ( ) #NEWLINE# df . sort_index ( axis = 1 , ascending = False , inplace = True ) #NEWLINE# expected = frame . ix [ : , : : ( - 1 ) ] #NEWLINE# assert_frame_equal ( df , expected )