In [2]:
import numpy as np
import matplotlib.pyplot as plt
from scipy import sparse
import pandas as pd
from IPython.display import display
import mglearn
import sklearn
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor

# Load in data file
data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
# Make arrays containing x-axis and hares and lynx populations
#How do you import this data to IPython? Ask Morten
year = data[:,0]
hares = data[:,1]
lynx = data[:,2]

plt.plot(year, hares ,'b-+', year, lynx, 'r-o')
plt.axis([1900,1920,0, 100.0])
plt.ylabel(r'Numbers of hares and lynx ')
plt.legend(('Hares','Lynx'), loc='upper right')
plt.title(r'Population of hares and lynx from 1900-1920 (x1000)}')

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-2-7c0c8f9a022b> in <module>()
     11 # Load in data file
---> 12 data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
     13 # Make arrays containing x-axis and hares and lynx populations
     14 year = data[:,0]

/anaconda3/lib/python3.6/site-packages/numpy/lib/ in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin)
    896                 fh = iter(open(fname, 'U'))
    897             else:
--> 898                 fh = iter(open(fname))
    899         else:
    900             fh = iter(fname)

FileNotFoundError: [Errno 2] No such file or directory: 'src/Hudson_Bay.csv'

In [ ]: