Python statistics.pstdev() Method
Python statistics.pstdev() Used to compute the sample standard deviation of a given data set.
Syntax
The syntax of the statistics.pstdev() method is as follows:
statistics.pstdev(data, mu=None)
Parameter Description:
- data -- an iterable containing numeric values, such as a list or tuple.
- mu -- an optional parameter indicating the mean of the data set; if not provided, the function computes the mean internally.
Return Value
The function computes and returns the sample standard deviation from the given data set as the result.
Example
The following example demonstrates the pstdev() function:
Example
import
statistics
data
=
[
1
,
2
,
3
,
4
,
5
]
stdev
=
statistics.
pstdev
(
data
)
(
stdev
)
Output result:
1.5811388300841898
In the above example, the given data set is [1, 2, 3, 4, 5], and the pstdev() method computes a sample standard deviation of 1.5811388300841898.
The sample standard deviation is a statistic measuring the dispersion of a data set, indicating how far data values deviate from the mean. It is the square root of the variance and is used to describe how spread out the data is.
Python statistics Module