Python 라이브러리 - statistics

공식 문서

source code 링크

statistics

statistics는 평균값과 중앙값을 구할 때 사용하는 모듈입니다.

평균값은 statistics.mean() 함수를 사용하면 간단하게 구할 수 있습니다.

import statistics

mark = [79, 29, 40, 69, 90, 100, 74, 69]
print(statistics.mean(mark))        # 68.75

중앙값은 statistics.median() 함수를 사용해 구하면 됩니다.

print(statistics.median(mark))      # 71.5

 

 

 

 

'Python > Python' 카테고리의 다른 글

Python 라이브러리 - itertools  (0) 2023.05.20
Python 라이브러리 - operator.itemgetter  (0) 2023.05.18
Python 라이브러리 - random  (0) 2023.05.17
Python 라이브러리 - fractions  (0) 2023.05.17
Python 라이브러리 - decimal  (0) 2023.05.16