Skip to content

Timeframe

add_hourly_thresholds(hourly_stats, residual_lower, residual_upper)

Calculate and add fever and hypothermia thresholds.

PARAMETER DESCRIPTION
hourly_stats

The DataFrame with hourly median temperatures.

TYPE: DataFrame

residual_lower

The lower residual bound.

TYPE: float

residual_upper

The upper residual bound.

TYPE: float

RETURNS DESCRIPTION
DataFrame

A DataFrame with added columns for residual bounds and fever/hypothermia

DataFrame

thresholds.

calculate_stats_by_timeframe(df, timeframe, data_column='y', pred_column='y_hat', date_column='ds', start_from_first=True)

Calculate statistics by specified timeframe, with an option to start from the first timestamp.

PARAMETER DESCRIPTION
df

The input DataFrame.

TYPE: DataFrame

timeframe

Group statistics by timeframe - options are "hour" and "day".

TYPE: Literal['hour', 'day']

data_column

Name of column containing observed data.

TYPE: str DEFAULT: 'y'

pred_column

Name of column containing predicted data.

TYPE: str DEFAULT: 'y_hat'

date_column

The name of the column with timestamps.

TYPE: str DEFAULT: 'ds'

start_from_first

If True, groups by the first timestamp's interval; otherwise, uses calendar-based intervals.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
DataFrame

A DataFrame with aggregated statistics by specified timeframe.