std
Computes the standard deviation (std, σ) of values.
null
values are ignored.
All primitive numeric types are supported: Byte
, Short
, Int
, Long
, Float
, and Double
.
std
also supports the "mixed" Number
type, as long as the column consists only of the aforementioned primitive numbers. The numbers are automatically converted to a common type for the operation.
The return type is always Double
; Double.NaN
for empty columns.
All operations on Double
/Float
/Number
have the skipNaN
option, which is set to false
by default. This means that if a NaN
is present in the input, it will be propagated to the result. When it's set to true
, NaN
values are ignored.
Delta Degrees of Freedom: DDoF
All std
operations also have the ddof
(Delta Degrees of Freedom) argument.
The default is set to 1
, meaning DataFrame uses Bessel’s correction to calculate the "unbiased sample standard deviation" by default. This is also the standard in languages like R. However, it is different from the "population standard deviation" (where ddof = 0
), which is used in libraries like Numpy.
See statistics for details on complex data aggregations.
Type Conversion
The following automatic type conversions are performed for the mean
operation:
Conversion | Result for Empty Input |
---|---|
Int -> Double | Double.NaN |
Byte -> Double | Double.NaN |
Short -> Double | Double.NaN |
Long -> Double | Double.NaN |
Double -> Double | Double.NaN |
Float -> Double | Double.NaN |
Number -> Conversion(Common number type) -> Double | Double.NaN |
Nothing -> Double | Double.NaN |