Python Statistics.pstdev() Metoda
Przykład
Oblicz odchylenie standardowe z całej populacji:
# Import statistics Library
import statistics
# Calculate
the standard deviation from an entire population
print(statistics.pstdev([1, 3, 5, 7, 9, 11]))
print(statistics.pstdev([2,
2.5, 1.25, 3.1, 1.75, 2.8]))
print(statistics.pstdev([-11, 5.5, -3.4,
7.1]))
print(statistics.pstdev([1, 30, 50, 100]))
Definicja i użycie
Metoda statistics.pstdev()
oblicza odchylenie standardowe z całej populacji.
Odchylenie standardowe jest miarą rozłożenia liczb.
Duże odchylenie standardowe wskazuje, że dane są rozłożone, - małe odchylenie standardowe wskazuje, że dane są skupione wokół średniej.
Wskazówka: Odchylenie standardowe jest (w przeciwieństwie do Wariancji) wyrażone w tych samych jednostkach, co dane.
Wskazówka: odchylenie standardowe to pierwiastek kwadratowy z wariancji próbki .
Wskazówka: Aby obliczyć odchylenie standardowe z próbki danych, spójrz na statistics.stdev()
metodę.
Składnia
statistics.pstdev(data, xbar)
Wartości parametrów
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 |
Uwaga: Jeśli dane są puste, zwraca błąd StatisticsError.
Szczegóły techniczne
Wartość zwrotu: | Wartość float reprezentująca odchylenie standardowe populacji podanych danych |
---|---|
Wersja Pythona: | 3.4 |