@@ -1484,6 +1484,9 @@ def test_describe():
1484
1484
"""Test NestedFrame.describe gives correct results with and without the nested columns"""
1485
1485
base_mix = NestedFrame (data = {"a" : [1 , 2 , 3 ], "b" : ["2" , "4" , "6" ], "c" : ["x" , "y" , "z" ]}, index = [0 , 1 , 2 ])
1486
1486
base_num = NestedFrame (data = {"a" : [1 , 2 , 3 ], "b" : [2 , 3 , 2 ], "c" : [55 , 55 , 55 ]}, index = [0 , 1 , 2 ])
1487
+ base_obj = NestedFrame (
1488
+ data = {"a" : ["a" , "b" , "c" ], "b" : ["2" , "4" , "6" ], "c" : ["x" , "y" , "z" ]}, index = [0 , 1 , 2 ]
1489
+ )
1487
1490
1488
1491
nested_num = pd .DataFrame (
1489
1492
data = {"d" : [10 , 11 , 20 , 21 , 3 , 31 , 32 ], "y" : [1 , 2 , 3 , 4 , 5 , 6 , 7 ]}, index = [0 , 0 , 1 , 1 , 1 , 2 , 2 ]
@@ -1626,6 +1629,14 @@ def test_describe():
1626
1629
with pytest .raises (ValueError ):
1627
1630
base2 .describe (include = object )
1628
1631
1632
+ # edge case: object base with numeric nest
1633
+ base_obj = base_obj .add_nested (nested_mix , "nested_mix" ).add_nested (nested_num , "nested_num" )
1634
+ r18 = base_obj .describe ()
1635
+ assert isinstance (r18 , NestedFrame )
1636
+ assert r18 .shape [1 ] == 3
1637
+ assert "nested_mix.f" in r18 .columns
1638
+ assert "top" not in r18 .index
1639
+
1629
1640
1630
1641
def test_eval ():
1631
1642
"""
0 commit comments