covizpy.plot_spec

Module Contents

Functions

plot_spec(df, location=['Canada'], val='new_cases', date_from=None, date_to=None, title=None)

Create a line chart presenting specific country/countries COVID information

covizpy.plot_spec.plot_spec(df, location=['Canada'], val='new_cases', date_from=None, date_to=None, title=None)[source]

Create a line chart presenting specific country/countries COVID information within a time period

Parameters
  • df (Pandas dataframe) – Pandas dataframe of the selected covid data from get_data()

  • location (list, optional) – List of target country names or . By default [“Canada”]

  • val (str, optional) – Quantitative values of interests. Must be numeric variable. Also known as a ‘measure’. By default ‘new_cases’

  • date_from (str, optional) – Start date of the data range with format in “YYYY-MM-DD” format. By default ‘None’ is used to represent 7 days prior to today’s date

  • date_to (str, optional) – End date of data range with format in “YYYY-MM-DD” format. By default ‘None’ is used to represent today’s date

  • title (str, optional) – The title of the plot. By default ‘None’ will be generated based on val

Returns

Altair line chart created

Return type

plot

Examples

>>> plot_spec(df, location=["Canada", "Turkey"], val="new_cases", date_from="2022-01-01", date_to="2022-01-07")