text_html_output_1.png
import pandas as pd

monkeypox = pd.read_csv('../input/worldwide-monkeypox-daily-dataset/owid-monkeypox-data.csv')

monkeypox.replace('Congo', 'Democratic Republic of Congo', inplace=True)
monkeypox_countr = monkeypox[monkeypox['location'] != 'World'].copy()

def get_continent_country(x):
    NorthAmerica = ['Barbados', 'Bermuda', 'Canada', 'Greenland', 'Jamaica', 'Mexico', 'Panama', 'Costa Rica', 'Dominican Republic', 'Guatemala', 'Puerto Rico', 'United States', 'Bahamas', 'Cuba', 'Honduras']
    SouthAmerica = ['Argentina', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'Ecuador', 'Peru', 'Uruguay', 'Venezuela', 'Guyana', 'Paraguay']
    Europe = ['Andorra', 'Austria', 'Belgium', 'Bosnia and Herzegovina', 'Bulgaria', 'Croatia', 'Czechia', 'Denmark', 'Estonia', 'Finland', 'France', 'Georgia', 'Germany', 'Greece', 'Hungary', 'Iceland', 'Ireland', 'Italy', 'Latvia', 'Lithuania', 'Luxembourg', 'Malta', 'Moldova', 'Montenegro', 'Netherlands', 'Norway', 'Poland', 'Portugal', 'Romania', 'Serbia', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'Switzerland', 'United Kingdom', 'Monaco']
    Africa = ['Benin', 'Cameroon', 'Central African Republic', 'Democratic Republic of Congo', 'Ghana', 'Liberia', 'Morocco', 'Nigeria', 'South Africa', 'Sudan']
    Asia = ['Cyprus', 'India', 'Israel', 'Japan', 'Lebanon', 'Philippines', 'Qatar', 'Russia', 'Saudi Arabia', 'Singapore', 'South Korea', 'Taiwan', 'Thailand', 'Turkey', 'United Arab Emirates', 'Indonesia', 'Iran']
    Oceania = ['Australia', 'New Zealand', 'New Caledonia']
    if x in NorthAmerica:
        return 'North America'
    elif x in SouthAmerica:
        return 'South America'
    elif x in Europe:
        return 'Europe'
    elif x in Africa:
        return 'Africa'
    elif x in Asia:
        return 'Asia'
    else:
        return 'Oceania'
continent = []
for country in monkeypox_countr['location']:
    y = get_continent_country(country)
    continent.append(y)
monkeypox_countr['Continent'] = pd.Series(continent)
monkeypox_cont = monkeypox_countr[['Continent', 'location', 'date', 'new_cases', 'new_cases_smoothed', 'total_cases', 'new_cases_per_million', 'total_cases_per_million', 'new_cases_smoothed_per_million', 'new_deaths', 'new_deaths_smoothed', 'total_deaths', 'new_deaths_per_million', 'total_deaths_per_million', 'new_deaths_smoothed_per_million']].copy()
monkeypox_cont.head()