Metode statistik Python.pvariance ()
Contoh
Hitung varians dari seluruh populasi:
# Import statistics Library
import statistics
# Calculate
the variance of an entire population
print(statistics.pvariance([1, 3, 5, 7, 9, 11]))
print(statistics.pvariance([2,
2.5, 1.25, 3.1, 1.75, 2.8]))
print(statistics.pvariance([-11, 5.5, -3.4,
7.1]))
print(statistics.pvariance([1, 30, 50, 100]))
Definisi dan Penggunaan
Metode statistics.pvariance()
ini menghitung varians dari seluruh populasi.
Sebuah varians besar menunjukkan bahwa data tersebar, - varians kecil menunjukkan bahwa data berkerumun dekat di sekitar mean.
Tip: Untuk menghitung varians dari sampel data, lihat statistics.variance()
metodenya.
Sintaksis
statistics.pvariance(data, xbar)
Nilai Parameter
Parameter | Description |
---|---|
data | Required. The data values to be used (can be any sequence, list or iterator) |
xbar | Optional. The mean of the given data (can also be a second moment around a point that is not the mean). If omitted (or set to None), the mean is automatically calculated |
Catatan: Jika data kosong, ia mengembalikan StatisticsError.
Detail Teknis
Nilai Kembali: | Sebuah float nilai, mewakili varians populasi dari data yang diberikan |
---|---|
Versi Python: | 3.4 |