@@ -668,24 +668,42 @@ def test_ix_align(self):
668668
669669 def test_ix_frame_align (self ):
670670 from pandas import DataFrame
671- df = DataFrame ( np . random . randn ( 2 , 10 ) )
672- df . sort_index ( inplace = True )
673- p_orig = Panel ( np . random . randn ( 3 , 10 , 2 ) )
671+ p_orig = tm . makePanel ( )
672+ df = p_orig . ix [ 0 ]. copy ( )
673+ assert_frame_equal ( p_orig [ 'ItemA' ], df )
674674
675675 p = p_orig .copy ()
676676 p .ix [0 , :, :] = df
677- out = p .ix [0 , :, :].T .reindex (df .index , columns = df .columns )
678- assert_frame_equal (out , df )
677+ assert_panel_equal (p , p_orig )
679678
680679 p = p_orig .copy ()
681680 p .ix [0 ] = df
682- out = p .ix [0 ].T .reindex (df .index , columns = df .columns )
683- assert_frame_equal (out , df )
681+ assert_panel_equal (p , p_orig )
682+
683+ p = p_orig .copy ()
684+ p .iloc [0 , :, :] = df
685+ assert_panel_equal (p , p_orig )
686+
687+ p = p_orig .copy ()
688+ p .iloc [0 ] = df
689+ assert_panel_equal (p , p_orig )
690+
691+ p = p_orig .copy ()
692+ p .loc ['ItemA' ] = df
693+ assert_panel_equal (p , p_orig )
694+
695+ p = p_orig .copy ()
696+ p .loc ['ItemA' , :, :] = df
697+ assert_panel_equal (p , p_orig )
698+
699+ p = p_orig .copy ()
700+ p ['ItemA' ] = df
701+ assert_panel_equal (p , p_orig )
684702
685703 p = p_orig .copy ()
686704 p .ix [0 , [0 , 1 , 3 , 5 ], - 2 :] = df
687705 out = p .ix [0 , [0 , 1 , 3 , 5 ], - 2 :]
688- assert_frame_equal (out , df .T . reindex ([ 0 , 1 , 3 , 5 ], p . minor_axis [ - 2 :]) )
706+ assert_frame_equal (out , df .iloc [[ 0 , 1 , 3 , 5 ],[ 2 , 3 ]] )
689707
690708 # GH3830, panel assignent by values/frame
691709 for dtype in ['float64' ,'int64' ]:
0 commit comments