From 05709efc7a19a727ed9d1508df9a16a2c4f4db33 Mon Sep 17 00:00:00 2001 From: E33605 Date: Fri, 13 Dec 2024 12:19:37 +0530 Subject: [PATCH] ENH: removed median percentile to be always included in describe - fixes #60550 - median percentile is default when a blank list of percentiles is passed --- pandas/core/methods/describe.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/methods/describe.py b/pandas/core/methods/describe.py index 17d4d38c97f33..f8dbd669058d3 100644 --- a/pandas/core/methods/describe.py +++ b/pandas/core/methods/describe.py @@ -351,13 +351,13 @@ def _refine_percentiles( # explicit conversion of `percentiles` to list percentiles = list(percentiles) + # median should be included only if blank list is passed + if len(percentiles) == 0: + percentiles.append(0.5) + # get them all to be in [0, 1] validate_percentile(percentiles) - # median should always be included - if 0.5 not in percentiles: - percentiles.append(0.5) - percentiles = np.asarray(percentiles) # sort and check for duplicates