Ejemplo n.º 1
0
def load_standardized(df):
    df = df[[
        "date", "location", "new_cases", "new_deaths", "total_cases",
        "total_deaths"
    ]]
    df = inject_owid_aggregates(df)
    df = discard_rows(df)
    df = inject_weekly_growth(df)
    df = inject_biweekly_growth(df)
    df = inject_doubling_days(df)
    df = inject_per_million(df, [
        "new_cases", "new_deaths", "total_cases", "total_deaths",
        "weekly_cases", "weekly_deaths", "biweekly_cases", "biweekly_deaths"
    ])
    df = inject_rolling_avg(df)
    df = inject_cfr(df)
    df = inject_days_since(df)
    df = inject_exemplars(df)
    return df.sort_values(by=["location", "date"])
Ejemplo n.º 2
0
def load_standardized(filename):
    df = _load_merged(filename) \
        .drop(columns=[
            'countriesAndTerritories', 'geoId',
            'day', 'month', 'year',
        ]) \
        .rename(columns={
            'dateRep': 'date',
            'cases': 'new_cases',
            'deaths': 'new_deaths'
        })
    df = df[['date', 'location', 'new_cases', 'new_deaths']]
    df = inject_owid_aggregates(df)
    df = discard_rows(df)
    df = inject_total_daily_cols(df, ['cases', 'deaths'])
    df = inject_per_million(
        df, ['new_cases', 'new_deaths', 'total_cases', 'total_deaths'])
    df = inject_cfr(df)
    df = inject_rolling_avg(df)
    df = inject_days_since_all(df)
    df = inject_exemplars(df)
    return df.sort_values(by=['location', 'date'])