opendvp.metrics.coefficient_of_variation#
- coefficient_of_variation(df, axis=0, nan_policy='propagate', ddof=1)#
Calculate the coefficient of variation.
(CV = std / mean) along a specified axis of a DataFrame.
- Parameters:
df (pandas.DataFrame) – Input DataFrame.
axis (int, default 0) – 0 for column-wise CV, 1 for row-wise CV.
nan_policy ({'propagate', 'raise', 'omit'}, default 'propagate') –
‘propagate’: returns NaN if NaN is present
’raise’: raises ValueError if NaN is present
’omit’: ignores NaNs in the calculation
ddof (int, default 1) – Delta Degrees of Freedom used in the std calculation. The divisor used in calculations is N - ddof, default is 1
- Returns:
CV values for each row or column.
- Return type:
- Raises:
ValueError – If nan_policy=’raise’ and NaNs are present