@@ -333,6 +333,33 @@ def test_frame_empty_mixedtype(self):
333
333
self .assertTrue (df ._is_mixed_type )
334
334
assert_frame_equal (read_json (df .to_json (), dtype = dict (df .dtypes )), df )
335
335
336
+ def test_frame_mixedtype_orient (self ): # GH10289
337
+ vals = [[10 , 1 , 'foo' , .1 , .01 ],
338
+ [20 , 2 , 'bar' , .2 , .02 ],
339
+ [30 , 3 , 'baz' , .3 , .03 ],
340
+ [40 , 4 , 'qux' , .4 , .04 ]]
341
+
342
+ df = DataFrame (vals , index = list ('abcd' ),
343
+ columns = ['1st' , '2nd' , '3rd' , '4th' , '5th' ])
344
+
345
+ self .assertTrue (df ._is_mixed_type )
346
+ right = df .copy ()
347
+
348
+ for orient in ['split' , 'index' , 'columns' ]:
349
+ inp = df .to_json (orient = orient )
350
+ left = read_json (inp , orient = orient , convert_axes = False )
351
+ assert_frame_equal (left , right )
352
+
353
+ right .index = np .arange (len (df ))
354
+ inp = df .to_json (orient = 'records' )
355
+ left = read_json (inp , orient = 'records' , convert_axes = False )
356
+ assert_frame_equal (left , right )
357
+
358
+ right .columns = np .arange (df .shape [1 ])
359
+ inp = df .to_json (orient = 'values' )
360
+ left = read_json (inp , orient = 'values' , convert_axes = False )
361
+ assert_frame_equal (left , right )
362
+
336
363
def test_v12_compat (self ):
337
364
df = DataFrame (
338
365
[[1.56808523 , 0.65727391 , 1.81021139 , - 0.17251653 ],
0 commit comments