#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt mydtype=np.dtype([('Year','x, data['Annual']->y m,b = result[0] # m,b coefficients of y = mx + b mp,bp = np.polyfit(data['Year'],data['Annual'],1) # alternative way to # calculate m,b coefficients plt.plot(data['Year'],data['Annual'], 'o', data['Year'],m * data['Year'] + b,'b', data['Year'],mp * data['Year'] + bp,'g',) # test the fit