#NEWLINE# def test_SquareTable_from_data( ) : #NEWLINE# #INDENT# np . random . seed ( 434 ) #NEWLINE# df = pd . DataFrame ( index = range ( 100 ) , columns = [ 'v1' , 'v2' ] ) #NEWLINE# df [ 'v1' ] = np . random . randint ( 0 , 5 , 100 ) #NEWLINE# df [ 'v2' ] = np . random . randint ( 0 , 5 , 100 ) #NEWLINE# table = pd . crosstab ( df [ 'v1' ] , rslt2 [ 'v2' ] ) #NEWLINE# rslt1 = ctab . SquareTable ( table ) #NEWLINE# rslt2 = ctab . SquareTable . from_data ( df ) #NEWLINE# rslt3 = ctab . SquareTable ( np . asarray ( table ) ) #NEWLINE# assert_equal ( rslt1 . summary ( ) . as_text ( ) , rslt2 . summary ( ) . as_text ( ) ) #NEWLINE# assert_equal ( rslt2 . summary ( ) . as_text ( ) , rslt3 . summary ( ) . as_text ( ) )