Skip to content

Instantly share code, notes, and snippets.

View coreyjwade's full-sized avatar

Corey Wade coreyjwade

View GitHub Profile
# 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']
# 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
# Title plot
plt.title('Coronavirus Recoveries through May 7, 2020', size=15)
# Create horizontal bar plot
sns.barplot(x=x_vals, y=y_vals, palette='Greens_r')
# Create horizontal bar plot
sns.barplot(x=x_vals, y=y_vals, palette='Greens_r')
# Set size of figure
plt.figure(figsize=(16,9))
# 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']
# Import matplotlib
import matplotlib.pyplot as plt
# Import seaborn
import seaborn as sns
# Set dark grid
sns.set()
# Import matplotlib
import matplotlib.pyplot as plt
# Create bar chart
plt.bar(x_vals, y_vals)
# Show graph
plt.show()
# Choose relevant columns
df = df[['Confirmed', 'Deaths', 'Recovered', 'Active']]