@@ -422,8 +422,8 @@ def test_describe_empty_percentiles(self):
422
422
# Case 1: Passing an empty list
423
423
result = df .describe (percentiles = [])
424
424
expected = DataFrame (
425
- {"a" : [5 ,3 , 1.581139 ,1 , 5 ]},
426
- index = ["count" ,"mean" ,"std" ,"min" ,"max" ],
425
+ {"a" : [5 , 3 , 1.581139 , 1 , 5 ]},
426
+ index = ["count" , "mean" , "std" , "min" , "max" ],
427
427
)
428
428
tm .assert_frame_equal (result , expected )
429
429
@@ -438,37 +438,34 @@ def test_describe_with_single_percentile(self):
438
438
# Case 1: Passing a single percentile
439
439
result = df .describe (percentiles = [0.5 ])
440
440
expected = DataFrame (
441
- {"a" : [5 , 3 , 1.581139 ,1 , 3 , 5 ]},
442
- index = ["count" ,"mean" ,"std" ,"min" ,"50%" ,"max" ],
441
+ {"a" : [5 , 3 , 1.581139 , 1 , 3 , 5 ]},
442
+ index = ["count" , "mean" , "std" , "min" , "50%" , "max" ],
443
443
)
444
444
tm .assert_frame_equal (result , expected )
445
-
446
445
447
446
def test_describe_empty_numpy_percentile (self ):
448
447
df = DataFrame ({"a" : [1 , 2 , 3 , 4 , 5 ]})
449
-
450
- # Passing empty NumPy array as percentiles
448
+
449
+ # Passing empty NumPy array as percentiles
451
450
result = df .describe (percentiles = np .array ([]))
452
451
453
- # Expected output should only include count, mean, std, min, and max (no percentiles)
452
+ # Expected output should not include percentiles
454
453
expected = DataFrame (
455
- {"a" : [5 , 3.0 , 1.581139 , 1 , 5 ]},
456
- index = ["count" , "mean" , "std" , "min" , "max" ]
457
- )
454
+ {"a" : [5 , 3.0 , 1.581139 , 1 , 5 ]},
455
+ index = ["count" , "mean" , "std" , "min" , "max" ],
456
+ )
458
457
tm .assert_frame_equal (result , expected )
459
458
460
-
461
-
462
459
def test_describe_empty_series_percentile (self ):
463
460
df = DataFrame ({"a" : [1 , 2 , 3 , 4 , 5 ]})
464
-
465
- # Passing empty Series as percentiles
466
- result = df .describe (percentiles = pd .Series ([], dtype = float ))
467
461
468
- # Expected output should only include count, mean, std, min, and max (no percentiles)
462
+ # Passing empty Series as percentiles
463
+ result = df .describe (percentiles = Series ([], dtype = float ))
464
+
465
+ # Expected output should not include percentiles
469
466
expected = DataFrame (
470
- {"a" : [5 , 3.0 , 1.581139 , 1 , 5 ]},
471
- index = ["count" , "mean" , "std" , "min" , "max" ]
472
- )
467
+ {"a" : [5 , 3.0 , 1.581139 , 1 , 5 ]},
468
+ index = ["count" , "mean" , "std" , "min" , "max" ],
469
+ )
473
470
474
- tm .assert_frame_equal (result , expected )
471
+ tm .assert_frame_equal (result , expected )
0 commit comments