PYTHON MEDIAN MODULE
The median is a simple measure of central tendency. To find the median, we arrange the observations in order from smallest to largest value. If there is an odd number of observations, the median is the middle value. If there is an even number of observations, the median is the average of the two middle values.
Sensitivity to Outliers:
The median is a robust measure of central location and is less affected by the presence of outliers.
How to calculate Median:
( i ) When the number of data points is odd, the middle data point is returned.
Eg: median([1, 3, 5]) gives value 3.
(ii)When the number of data points is even, the median is interpolated by taking the average of the two middle values.
Eg: median([1, 3, 5, 7]) gives value 4.0.
If data is empty,
StatisticsError is raised. data can be a sequence or iterable.
import statistics as st if __name__=="__main__":
med=st.median([54, 24, 36])