• 회원가입
  • 로그인
  • 구글아이디로 로그인

[module] Python - statistics.harmonic_mean() 메서드 - 조화 평균값 (= harmonic_mean메서드 = 하모닉민)

1005  

목차

  1. statistics.harmonic_mean() 예제 - 조화 평균값 구하기.
  2. statistics.harmonic_mean() 정의
  3. statistics.harmonic_mean() 구문

 

statistics.harmonic_mean() 예제 - 조화 평균값.

 

import statistics


print(statistics.harmonic_mean([1, 2, 3, 4, 5]))

# 2.18978102189781


print(statistics.harmonic_mean([1, 3, 5]))

# 1.9565217391304348


 

statistics.harmonic_mean() 정의

 

주어진 데이터의 조화 평균값 구하기.

※ 조화 평균 = 데이터 역수의 산술 평균의 역수.

※ 조화 평균 = n / (1/a + 1/b + ... + 1/n)

※ 조화 평균 : 평균 변화율 구할 때 주로 사용.

※ Python 3.6 이상.

 


statistics.harmonic_mean() 구문

 

statistics.harmonic_mean(data)

 


[매개변수]

 

data

필수. 최소 1개 이상 데이터 있는 숫자 시퀀스.
※ 시퀀스 예: List, Tuple, Set 등

※ 음수는 불가.

※ data 없는 경우, StatisticsError 에러 반환.

 


[반환값]

 

float 자료형의 조화 평균값.

 



분류 제목
module Python - statistics.stdev() 메서드 -
module Python - statistics.pvariance() 메서드 -
module Python - statistics.variance() 메서드 -
module Python - math 모듈 메서드・상수 종류 (※ 수학 모듈)
module Python - math.acos() 메서드 -
module Python - math.acosh() 메서드 -
module Python - math.asin() 메서드 -
module Python - math.asinh() 메서드 -
module Python - math.atan() 메서드 -
module Python - math.atan2() 메서드 -
module Python - math.atanh() 메서드 -
module Python - math.ceil() 메서드 ★ - 천장 반올림 (= 상위 정수로 반올림. = ceil메서드…
module Python - math.comb() 메서드 -
module Python - math.copysign() 메서드 -
module Python - math.cos() 메서드 -
module Python - math.cosh() 메서드 -
module Python - math.degrees() 메서드 -
module Python - math.dist() 메서드 -
module Python - math.erf() 메서드 -
module Python - math.erfc() 메서드 -
3/7
목록
찾아주셔서 감사합니다. Since 2012