glucopy.Gframe.cv#

Gframe.cv(per_day: bool = False, ddof: int = 1)[source]#

Calculates the Coefficient of Variation (CV) of the CGM values.

Parameters:
  • per_day (bool, default False) – If True, returns a pandas.Series with the coefficient of variation for each day. If False, returns the coefficient of variation for the entire dataset.

  • ddof (int, default 1) – Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is 1.

Returns:

cv – Coefficient of variation of the CGM values.

Return type:

float | pandas.Series

Examples

Calculating the coefficient of variation for the entire dataset:

In [1]: import glucopy as gp

In [2]: gf = gp.data('prueba_1')

In [3]: gf.cv()
Out[3]: 0.44863039748753963

Calculating the coefficient of variation for each day:

In [4]: gf.cv(per_day=True)
Out[4]: 
Day
2020-11-27    0.087655
2020-11-28    0.316007
2020-11-29    0.429772
2020-11-30    0.258088
2020-12-01    0.303172
                ...   
2021-03-14    0.281663
2021-03-15    0.601054
2021-03-16    0.272666
2021-03-17    0.325162
2021-03-18    0.294188
Name: Coefficient of Variation, Length: 112, dtype: float64