1from scipy import stats
2
3slope, intercept, r_value, p_value, std_err = stats.linregress(years, mean_rainfall_per_year)
4
5pyplot.plot(years, mean_rainfall_per_year, 'b-', label='Data')
6pyplot.plot(years, intercept + slope*years, 'k-', label='Linear Regression')
7pyplot.xlabel('Year')
8pyplot.ylabel('Mean rainfall')
9pyplot.legend();
10