How to use the akshare.wdbank.api.WBSeries function in akshare

To help you get started, we’ve selected a few akshare examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jindaxiang / akshare / akshare / wdbank / api.py View on Github external
source=source,
        convert_date=convert_date,
        cache=cache,
    )
    df = pd.DataFrame(
        [[i["country"]["value"], i["date"], i["value"]] for i in raw_data],
        columns=["country", "date", column_name],
    )
    df[column_name] = df[column_name].map(cast_float)
    if not keep_levels and len(df["country"].unique()) == 1:
        df = df.set_index("date")
    elif not keep_levels and len(df["date"].unique()) == 1:
        df = df.set_index("country")
    else:
        df = df.set_index(["country", "date"])
    series = WBSeries(df[column_name])
    series.last_updated = raw_data.last_updated
    return series