Python의 모듈은 생물 통계 및 비즈니스 분석과 같은 데이터의 전반적인 특성을 빠르게 이해하는 데 도움이되는 강력한 데이터 통계 분석 기능을 제공합니다. 데이터 포인트를 하나씩 보는 대신 평균 또는 분산과 같은 통계를보고 무시할 수있는 원래 데이터에서 트렌드와 기능을 발견하고 대형 데이터 세트를보다 쉽고 효과적으로 비교하십시오.
이 자습서는 평균을 계산하고 데이터 세트의 분산 정도를 측정하는 방법을 설명합니다. 달리 명시되지 않는 한,이 모듈의 모든 함수는 단순히 평균을 합산하는 대신 함수를 사용하여 평균 값의 계산을 지원합니다. 부동 소수점 번호도 사용할 수 있습니다. statistics
mean()
import random import statistics from fractions import Fraction as F int_values = [random.randrange(100) for x in range(9)] frac_values = [F(1, 2), F(1, 3), F(1, 4), F(1, 5), F(1, 6), F(1, 7), F(1, 8), F(1, 9)] mix_values = [*int_values, *frac_values] print(statistics.mean(mix_values)) # 929449/42840 print(statistics.fmean(mix_values)) # 21.69582166199813예외가 발생합니다.
geometric_mean(data, weights=None)
harmonic_mean(data, weights=None)
import statistics growth_rates = [20, 25, 33.33] print(statistics.mean(growth_rates)) # 26.11 print(statistics.geometric_mean(growth_rates)) # 25.542796263143476중앙값
를 계산합니다
StatisticsError
이 함수의 두 번째 매개 변수는 선택 사항입니다. mu
는 주어진 샘플의 평균이며 제공되지 않으면 자동으로 계산됩니다.
import statistics speeds = [30, 40, 60] distance = 100 total_distance = len(speeds) * distance total_time = 0 for speed in speeds: total_time += distance / speed average_speed = total_distance / total_time print(average_speed) # 39.99999999999999 print(statistics.harmonic_mean(speeds)) # 40.0및 함수를 사용하여 계산할 수 있습니다.
import random import statistics from fractions import Fraction as F int_values = [random.randrange(100) for x in range(9)] frac_values = [F(1, 2), F(1, 3), F(1, 4), F(1, 5), F(1, 6), F(1, 7), F(1, 8), F(1, 9)] mix_values = [*int_values, *frac_values] print(statistics.mean(mix_values)) # 929449/42840 print(statistics.fmean(mix_values)) # 21.69582166199813
요약
이 시리즈의 마지막 튜토리얼에서
위 내용은 파이썬의 수학 모듈 : 통계의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

Pythonusesahybridmodelofilationandlostretation : 1) ThePyThoninterPretreCeterCompileSsourcodeIntOplatform-IndependentBecode.

Pythonisbothingretedandcompiled.1) 1) it 'scompiledtobytecodeforportabilityacrossplatforms.2) thebytecodeisthentenningreted, withfordiNamictyTeNgreted, WhithItmayBowerShiledlanguges.

forloopsareusedwhendumberofitessiskNowninadvance, whilewhiloopsareusedwhentheationsdepernationsorarrays.2) whiloopsureatableforscenarioScontiLaspecOndCond

pythonisnotpurelynlogreted; itusesahybrideprophorfbyodecodecompilationandruntime -INGRETATION.1) pythoncompilessourcecodeintobytecode, thepythonVirtualMachine (pvm)

ToconcatenatelistsinpythonwithesameElements, 사용 : 1) OperatorTokeEpduplicates, 2) asettoremovedUplicates, or3) listComperensionForControlOverDuplicates, 각 methodHasDifferentPerferformanCeanDorderImpestications.

PythonisancerpretedLanguage, 비판적 요소를 제시하는 PytherfaceLockelimitationsIncriticalApplications.1) 해석 된 언어와 같은 thePeedBackandbackandrapidProtoTyping.2) CompilledlanguagesLikec/C transformt 해석

useforloopswhhenmerfiterationsiskNownInAdvance 및 WhileLoopSweHeniTesslationsDepoyConditionismet whilEroopsSuitsCenarioswhereTheLoopScenarioswhereTheLoopScenarioswhereTheLoopScenarioswhereTherInatismet, 유용한 광고 인 푸트 gorit


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

WebStorm Mac 버전
유용한 JavaScript 개발 도구

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)