Skip to content

Instantly share code, notes, and snippets.

@LowriWilliams
Last active May 20, 2020 09:55
Show Gist options
  • Save LowriWilliams/5ce94dae3f37a94d0848d17c6c19e387 to your computer and use it in GitHub Desktop.
Save LowriWilliams/5ce94dae3f37a94d0848d17c6c19e387 to your computer and use it in GitHub Desktop.
corona/coronavirus_countries
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Countires affected: ['China', 'US', 'Japan', 'Thailand', 'South Korea', 'Mainland China', 'Hong Kong', 'Macau', 'Taiwan', 'Singapore', 'Philippines', 'Malaysia', 'Vietnam', 'Australia', 'Mexico', 'Brazil', 'France', 'Nepal', 'Canada', 'Cambodia', 'Sri Lanka', 'Ivory Coast', 'Germany', 'Finland', 'United Arab Emirates', 'India', 'Italy', 'Sweden', 'Russia', 'Spain', 'UK', 'Belgium']\n",
"\n",
"Total countries affected by virus: 32\n"
]
}
],
"source": [
"# Countries affected\n",
"\n",
"countries = df['Country'].unique().tolist()\n",
"\n",
"print(\"\\nCountires affected:\" , countries)\n",
"\n",
"print(\"\\nTotal countries affected by virus: \", len(countries))"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Countires affected: ['China', 'US', 'Japan', 'Thailand', 'South Korea', 'Hong Kong', 'Macau', 'Taiwan', 'Singapore', 'Philippines', 'Malaysia', 'Vietnam', 'Australia', 'Mexico', 'Brazil', 'France', 'Nepal', 'Canada', 'Cambodia', 'Sri Lanka', 'Ivory Coast', 'Germany', 'Finland', 'United Arab Emirates', 'India', 'Italy', 'Sweden', 'Russia', 'Spain', 'UK', 'Belgium']\n",
"\n",
"Total countries affected by virus: 31\n"
]
}
],
"source": [
"# Combining China and Mainland China cases\n",
"\n",
"df['Country'].replace({'Mainland China':'China'}, inplace = True)\n",
"\n",
"countries = df['Country'].unique().tolist()\n",
"\n",
"print(\"\\nCountires affected:\" , countries)\n",
"\n",
"print(\"\\nTotal countries affected by virus: \", len(countries))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment