src.testing.shared
¶
Module Contents¶
Functions¶
Create date from year and week. |
|
|
Convert from a weekly to a daily index. |
|
Get a linearly interpolated share known cases for one day. |
|
Get a linearly interpolated share known cases series. |
- get_date_from_year_and_week(row)[source]¶
Create date from year and week.
We take the Sunday of each week.
- convert_weekly_to_daily(df, divide_by_7_cols)[source]¶
Convert from a weekly to a daily index.
Each week is filled with the observation of the end of the week. Together with get_date_from_year_and_week taking the Sunday of each week, this yields the week’s values for Mon through Sun to be the values of reported for that week.
- Parameters
df (pandas.DataFrame) – DataFrame with
divide_by_7_cols (list) – list of columns that have to be divided by 7. So for example the number of participating laboratories does not change from a weekly to daily representation of the data but the available number of tests on each day is (ignoring weekends) a seventh of the weekly capacity.
- get_piecewise_linear_interpolation_for_one_day(date, params_slice)[source]¶
Get a linearly interpolated share known cases for one day.
- Parameters
date (pandas.Timestamp) – Date at which the function is evaluated.
params_slice (pandas.Series) – Series with DateIndex. The values are function values corresponding to that date.
- Returns
The value of the function at that date.
- Return type