In [2]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

In [7]:
time = np.arange(10)

In [8]:
time


Out[8]:
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

In [15]:
position = np.arange(0, 100, 10)

In [16]:
position


Out[16]:
array([ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90])

In [17]:
len(time)


Out[17]:
10

In [18]:
len(position)


Out[18]:
10

In [19]:
plt.plot(time, position)
plt.xlabel('Time (hr)')
plt.ylabel('Position (km)')


Out[19]:
Text(0,0.5,'Position (km)')

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]:
<matplotlib.axes._subplots.AxesSubplot at 0x116efd128>

In [29]:
europe_t = europe.T
europe_t.plot()
plt.ylabel('GDP per capita')


Out[29]:
Text(0,0.5,'GDP per capita')

In [ ]: