Answers for "find mean mode median in python"

3

median in python

import statistics

statistics.median(list_name)
Posted by: Guest on May-23-2020
1

mean median mode using python

import numpy

speed = [99,86,87,88,86,103,87,94,78,77,85,86]

  
x = numpy.median(speed)

print(x)
Posted by: Guest on February-17-2021
1

finding median on python

def calculate_median(n):
    N = len(n)
    n.sort()
    
    #find the median
    if N % 2 == 0:
        #if N is even
        m1 = N / 2
        m2 = (N / 2) + 1
        #Convert to integer, match post
        m1 = int(m1) - 1
        m2 = int(m2) - 1
        median = (n[m1] + n[m2]) / 2 
    else:
        m = (N + 1) / 2
        # Convert to integer, match position
        m = int(m) - 1
        median = n[m]
    
    return median
  
# Doing Math With Python
Posted by: Guest on December-28-2020
0

calculate mean median mode in python

>>> import statistics

>>> statistics.median([3, 5, 1, 4, 2])
3

>>> statistics.median([3, 5, 1, 4, 2, 6])
3.5
Posted by: Guest on January-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language