bundles / scipy 1.17.1 / scipy / stats / _probability_distribution / _ProbabilityDistribution / median
function
scipy.stats._probability_distribution:_ProbabilityDistribution.median
Signature
def median ( self , * , method ) Summary
Median (50th percentile)
Extended Summary
If a continuous random variable has probability of taking on a value less than , then is the median.
More generally, a median is a value for which:
For discrete random variables, the median may not be unique, in which case the smallest value satisfying the definition is reported.
Parameters
method: {None, 'formula', 'icdf'}The strategy used to evaluate the median. By default (
None), the infrastructure chooses between the following options, listed in order of precedence.'formula': use a formula for the median'icdf': evaluate the inverse CDF of 0.5
Not all
methodoptions are available for all distributions. If the selectedmethodis not available, aNotImplementedErrorwill be raised.
Returns
out: arrayThe median
Examples
Instantiate a distribution with the desired parameters:from scipy import stats X = stats.Uniform(a=0., b=10.)✓
X.median()
✓X.median() == X.icdf(0.5) == X.iccdf(0.5)
✗See also
Aliases
-
scipy.stats._distribution_infrastructure._ProbabilityDistribution.median