#NEWLINE# def test_operators( self ) : #NEWLINE# #INDENT# def _check_ops( panel ) : #NEWLINE# #INDENT# def _dense_comp( op ) : #NEWLINE# #INDENT# with tm . assert_produces_warning ( FutureWarning , check_stacklevel = False ) : #NEWLINE# #INDENT# dense = panel . to_dense ( ) #NEWLINE# sparse_result = op ( panel ) #NEWLINE# dense_result = op ( dense ) #NEWLINE# tm . assert_panel_equal ( sparse_result . to_dense ( ) , dense_result ) #NEWLINE# #UNINDENT# #UNINDENT# def _mixed_comp( op ) : #NEWLINE# #INDENT# with tm . assert_produces_warning ( FutureWarning , check_stacklevel = False ) : #NEWLINE# #INDENT# result = op ( panel , panel . to_dense ( ) ) #NEWLINE# expected = op ( panel . to_dense ( ) , panel . to_dense ( ) ) #NEWLINE# tm . assert_panel_equal ( result , expected ) #NEWLINE# #UNINDENT# #UNINDENT# op1 = ( lambda x : ( x + 2 ) ) #NEWLINE# _dense_comp ( op1 ) #NEWLINE# op2 = ( lambda x : x . add ( x . reindex ( major = x . major_axis [ : : 2 ] ) ) ) #NEWLINE# _dense_comp ( op2 ) #NEWLINE# op3 = ( lambda x : x . subtract ( x . mean ( 0 ) , axis = 0 ) ) #NEWLINE# _dense_comp ( op3 ) #NEWLINE# op4 = ( lambda x : x . subtract ( x . mean ( 1 ) , axis = 1 ) ) #NEWLINE# _dense_comp ( op4 ) #NEWLINE# op5 = ( lambda x : x . subtract ( x . mean ( 2 ) , axis = 2 ) ) #NEWLINE# _dense_comp ( op5 ) #NEWLINE# _mixed_comp ( Panel . multiply ) #NEWLINE# _mixed_comp ( Panel . subtract ) #NEWLINE# #UNINDENT# _check_ops ( self . panel )