#NEWLINE# def test_constructor_mixed_dict_and_Series( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# data [ 'A' ] = { #NEWLINE# #INDENT# 'foo' : 1 , #NEWLINE# 'bar' : 2 , #NEWLINE# 'baz' : 3 , #NEWLINE# #UNINDENT# } #NEWLINE# data [ 'B' ] = Series ( [ 4 , 3 , 2 , 1 ] , index = [ 'bar' , 'qux' , 'baz' , 'foo' ] ) #NEWLINE# result = DataFrame ( data ) #NEWLINE# self . assertTrue ( result . index . is_monotonic ) #NEWLINE# with assertRaisesRegexp ( ValueError , 'ambiguous ordering' ) : #NEWLINE# #INDENT# DataFrame ( { #NEWLINE# #INDENT# 'A' : [ 'a' , 'b' ] , #NEWLINE# 'B' : { #NEWLINE# #INDENT# 'a' : 'a' , #NEWLINE# 'b' : 'b' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# result = DataFrame ( { #NEWLINE# #INDENT# 'A' : [ 'a' , 'b' ] , #NEWLINE# 'B' : Series ( [ 'a' , 'b' ] , index = [ 'a' , 'b' ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# expected = DataFrame ( { #NEWLINE# #INDENT# 'A' : [ 'a' , 'b' ] , #NEWLINE# 'B' : [ 'a' , 'b' ] , #NEWLINE# #UNINDENT# } , index = [ 'a' , 'b' ] ) #NEWLINE# assert_frame_equal ( result , expected )