@@ -367,6 +367,15 @@ def test_describe_percentiles_integer_idx(self):
367
367
)
368
368
tm .assert_frame_equal (result , expected )
369
369
370
+ def test_describe_does_not_raise_error_for_dictlike_elements (self ):
371
+ # GH#32409
372
+ df = DataFrame ([{"test" : {"a" : "1" }}, {"test" : {"a" : "2" }}])
373
+ expected = DataFrame (
374
+ {"test" : [2 , 2 , {"a" : "1" }, 1 ]}, index = ["count" , "unique" , "top" , "freq" ]
375
+ )
376
+ result = df .describe ()
377
+ tm .assert_frame_equal (result , expected )
378
+
370
379
@pytest .mark .parametrize ("exclude" , ["x" , "y" , ["x" , "y" ], ["x" , "z" ]])
371
380
def test_describe_when_include_all_exclude_not_allowed (self , exclude ):
372
381
"""
@@ -376,20 +385,3 @@ def test_describe_when_include_all_exclude_not_allowed(self, exclude):
376
385
msg = "exclude must be None when include is 'all'"
377
386
with pytest .raises (ValueError , match = msg ):
378
387
df .describe (include = "all" , exclude = exclude )
379
-
380
- def test_describe_does_not_raise_error (self ):
381
- # GH#32409
382
- df = DataFrame ([{"test" : {"a" : "1" }}, {"test" : {"a" : "2" }}])
383
- expected = DataFrame (
384
- {"test" : [2 , 2 , {"a" : "1" }, 1 ]}, index = ["count" , "unique" , "top" , "freq" ]
385
- )
386
- result = df .describe ()
387
- tm .assert_frame_equal (result , expected )
388
- exp_repr = (
389
- " test\n "
390
- "count 2\n "
391
- "unique 2\n "
392
- "top {'a': '1'}\n "
393
- "freq 1"
394
- )
395
- assert repr (result ) == exp_repr
0 commit comments