application_vnd.jupyter.stderr_output_2.png text_plain_output_1.png
import pandas as pd

npis_csv = '/kaggle/input/covid19-challenges/npi_canada.csv'
raw_data = pd.read_csv(npis_csv, encoding='ISO-8859-1')
df = raw_data.dropna(how='any', subset=['start_date', 'region', 'intervention_category'])
df['region'] = df['region'].replace('Newfoundland', 'Newfoundland and Labrador')
num_rows_removed = len(raw_data) - len(df)
print('Number of rows removed: {}'.format(num_rows_removed))
regions = list(set(df.region.values))
print('Number of unique regions: {}'.format(len(regions)))
num_cats = list(set(df.intervention_category.values))
num_interventions = len(num_cats)
print('Number of unique intervention categories: {}'.format(len(num_cats)))
df['start_date'] = pd.to_datetime(df['start_date'], format='%Y-%m-%d')
earliest_start_date = df['start_date'].min()
latest_start_date = df['start_date'].max()
num_days = latest_start_date - earliest_start_date
print('Analyzing from {} to {} ({} days)'.format(earliest_start_date.date(), latest_start_date.date(), num_days))
print('DONE READING DATA')