glucopy.metrics.fd#
- glucopy.metrics.fd(df: DataFrame, interval: list = [0, 70, 180], decimals: int = 2, count: bool = False)[source]#
Calculates the Frequency Distribution (FD) for a given target range of glucose.
\[FD = \frac{n_i}{N}\]\(n_i\) is the number of observations within the i-th interval.
\(N\) is the total number of observations.
- Parameters:
df (pandas.DataFrame) – DataFrame containing the CGM values. The dataframe must contain ‘CGM’ column present in
glucopy.Gframe.data
.interval (list of int|float, default [0,70,180]) – Target range in CGM unit. It must have at least 2 values, for the “normal” range, low and high values will be values outside that range.
decimals (int, default 2) – Number of decimal places to round to. Use None for no rounding.
count (bool, default False) – If True, returns the count of observations for each range. If False, returns the frequency of observations.
- Returns:
fd – Series of Frequency Distribution for each range.
- Return type:
Notes
This function is meant to be used by
glucopy.Gframe.fd()