This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create dataFrame, df_confirmed, of 10 countries with most confirmed cases | |
df_recovered = df.sort_values(by='Recovered', ascending=False)[:10] | |
# Convert index of countries to series for plotting | |
x_vals = df_recovered.index.to_series() | |
# Select 'Confirmed' column as y-values | |
y_vals = df_recovered['Recovered'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import matplotlib | |
import matplotlib.pyplot as plt | |
# Import seaborn | |
import seaborn as sns | |
# Set dark grid | |
sns.set() | |
# Convert index of countries to series for plotting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Title plot | |
plt.title('Coronavirus Recoveries through May 7, 2020', size=15) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create horizontal bar plot | |
sns.barplot(x=x_vals, y=y_vals, palette='Greens_r') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create horizontal bar plot | |
sns.barplot(x=x_vals, y=y_vals, palette='Greens_r') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set size of figure | |
plt.figure(figsize=(16,9)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert index of countries to series for plotting | |
y_vals = df_recovered.index.to_series() | |
# Select 'Recovered' column as y-values | |
x_vals = df_recovered['Recovered'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import matplotlib | |
import matplotlib.pyplot as plt | |
# Import seaborn | |
import seaborn as sns | |
# Set dark grid | |
sns.set() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import matplotlib | |
import matplotlib.pyplot as plt | |
# Create bar chart | |
plt.bar(x_vals, y_vals) | |
# Show graph | |
plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Choose relevant columns | |
df = df[['Confirmed', 'Deaths', 'Recovered', 'Active']] |
NewerOlder