median
statisticsCalculates the median (middle value) of values
Syntax
median(array|dataframe) Parameters
array|dataframe (array or dataframe) The data to calculate the median of
Returns
number The median value (middle value when sorted)
Examples
Input:
[1, 2, 3, 4, 5] | median Output:
3 Input:
[1, 2, 3, 4] | median Output:
2.5 Median response time from requests
Input:
.response_time | median Output:
245 The median() function calculates the median (middle value) of numeric values in an array or DataFrame column. For an even number of values, it returns the average of the two middle values.
Usage
Use median() for finding the central tendency that is less affected by outliers than the mean.