Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
22873187
Kaydet (Commit)
22873187
authored
Agu 23, 2016
tarafından
Steven D'Aprano
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add documentation for geometric and harmonic means.
üst
6877ed35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
statistics.rst
Doc/library/statistics.rst
+58
-0
No files found.
Doc/library/statistics.rst
Dosyayı görüntüle @
22873187
...
...
@@ -39,6 +39,8 @@ or sample.
======================= =============================================
:func:`mean` Arithmetic mean ("average") of data.
:func:`geometric_mean` Geometric mean of data.
:func:`harmonic_mean` Harmonic mean of data.
:func:`median` Median (middle value) of data.
:func:`median_low` Low median of data.
:func:`median_high` High median of data.
...
...
@@ -111,6 +113,62 @@ However, for reading convenience, most of the examples show sorted sequences.
``mean(data)`` is equivalent to calculating the true population mean μ.
.. function:: geometric_mean(data)
Return the geometric mean of *data*, a sequence or iterator of
real-valued numbers.
The geometric mean is the *n*-th root of the product of *n* data points.
It is a type of average, a measure of the central location of the data.
The geometric mean is appropriate when averaging quantities which
are multiplied together rather than added, for example growth rates.
Suppose an investment grows by 10% in the first year, falls by 5% in
the second, then grows by 12% in the third, what is the average rate
of growth over the three years?
.. doctest::
>>> geometric_mean([1.10, 0.95, 1.12])
1.0538483123382172
giving an average growth of 5.385%. Using the arithmetic mean will
give approximately 5.667%, which is too high.
:exc:``StatisticsError`` is raised if *data* is empty, or any
element is less than zero.
.. function:: harmonic_mean(data)
Return the harmonic mean of *data*, a sequence or iterator of
real-valued numbers.
The harmonic mean, sometimes called the subcontrary mean, is the
reciprocal of the arithmetic :func:``mean`` of the reciprocals of the
data. For example, the harmonic mean of three values *a*, *b* and *c*
will be equivalent to ``3/(1/a + 1/b + 1/c)``.
The harmonic mean is a type of average, a measure of the central
location of the data. It is often appropriate when averaging quantities
which are rates or ratios, for example speeds. For example:
Suppose an investor purchases an equal value of shares in each of
three companies, with P/E (price/earning) ratios of 2.5, 3 and 10.
What is the average P/E ratio for the investor's portfolio?
.. doctest::
>>> harmonic_mean([2.5, 3, 10]) # For an equal investment portfolio.
3.6
Using the arithmetic mean would give an average of about 5.167, which
is too high.
:exc:``StatisticsError`` is raised if *data* is empty, or any element
is less than zero.
.. function:: median(data)
Return the median (middle value) of numeric data, using the common "mean of
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment