Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created October 18, 2020 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/00e0f33143e962c4ee22d3cc162b5ca6 to your computer and use it in GitHub Desktop.
Save codecademydev/00e0f33143e962c4ee22d3cc162b5ca6 to your computer and use it in GitHub Desktop.
Codecademy export
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