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
films_plus_directors = films.merge(directors, on='director_id', how='inner').drop_duplicates() |
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
# Loading necessary libraries | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Plotting pretty figures and avoid blurry images | |
%config InlineBackend.figure_format = 'retina' | |
# No need to include %matplotlib inline magic command. These things come built-in now. | |
# Ignore warnings |
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
# Load some sample data | |
medals = pd.read_csv('data/medals_by_country_2016.csv', index_col=[0]) | |
climate_change = pd.read_csv('data/climate_change.csv', parse_dates=['date']) |
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
# Basic exploration | |
medals.info() | |
climate_change.info() | |
<class 'pandas.core.frame.DataFrame'> | |
Index: 10 entries, United States to Japan | |
Data columns (total 3 columns): | |
# Column Non-Null Count Dtype | |
--- ------ -------------- ----- | |
0 Bronze 10 non-null int64 | |
1 Gold 10 non-null int64 |
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
# Basic exploration | |
medals.info() | |
climate_change.info() | |
___________________ | |
<class 'pandas.core.frame.DataFrame'> | |
Index: 10 entries, United States to Japan | |
Data columns (total 3 columns): | |
# Column Non-Null Count Dtype | |
--- ------ -------------- ----- |
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 an arbitrary tuple | |
numbers = (10, 11, 12) | |
# Assign each of its values to a single variable | |
ten, eleven, twelve = numbers |
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
# Two variables because function returns tuple of size 2 | |
fig, ax = plt.subplots() |
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
plt.bar(medals.index, medals['Gold']) | |
plt.xticks(rotation=90) | |
plt.ylabel('# of gold medals'); |
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
plt.bar(medals.index, medals['Gold']) | |
plt.xticks(rotation=90) | |
plt.ylabel('# of gold medals') | |
plt.plot(climate_change['date'], climate_change['co2']); | |
_______________ | |
TypeError: tzinfo argument must be | |
None or of a tzinfo subclass, not type 'UnitData' |
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
fig, ax = plt.subplots() | |
ax.plot(climate_change['date'], climate_change['co2']) | |
ax.set(title='Amount of CO2 (ppm) in each year', xlabel='Year', | |
ylabel='Amount of CO2 (ppm)'); |