In [2]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
In [7]:
time = np.arange(10)
In [8]:
time
Out[8]:
In [15]:
position = np.arange(0, 100, 10)
In [16]:
position
Out[16]:
In [17]:
len(time)
Out[17]:
In [18]:
len(position)
Out[18]:
In [19]:
plt.plot(time, position)
plt.xlabel('Time (hr)')
plt.ylabel('Position (km)')
Out[19]:
In [27]:
# implicit plot a dataframe
import pandas as pd
europe = pd.read_csv('data/gapminder_gdp_europe.csv', index_col='country')
# extract just the year from columns
years = europe.columns.str.strip('gdpPercap_')
# convert years to integers and save it back to dataframe
europe.columns = years.astype(int)
europe.loc['Germany'].plot()
Out[27]:
In [29]:
europe_t = europe.T
europe_t.plot()
plt.ylabel('GDP per capita')
Out[29]:
In [ ]: