-
-
Save codecademydev/00e0f33143e962c4ee22d3cc162b5ca6 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains 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 codecademylib3_seaborn | |
from matplotlib import pyplot as plt | |
import pandas as pd | |
import seaborn as sns | |
df = pd.read_csv('WorldCupMatches.csv') | |
df['Total Goals'] = df['Home Team Goals'] + df['Away Team Goals'] | |
print(df.head()) | |
sns.set_style('whitegrid') | |
sns.set_context('poster', font_scale = 1) | |
f, ax = plt.subplots(figsize = (12,7)) | |
ax = sns.barplot( | |
data = df, | |
x = 'Year', | |
y = 'Total Goals' | |
) | |
ax.set_title('Goals Scored In World Cup by Year') | |
df_goals = pd.read_csv('goals.csv') | |
print(df_goals.head(10)) | |
sns.set_context('notebook', font_scale = 1.25) | |
f, ax2 = plt.subplots(figsize = (12,7)) | |
ax2 = sns.boxplot( | |
data = df_goals, | |
x = 'year', | |
y = 'goals', | |
palette = 'Spectral' | |
) | |
ax2.set_title('Goals scored in FIFA World Cup per Year') | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment