text_plain_output_1.png
from plotly.offline import iplot, init_notebook_mode

from scipy.stats import linregress

from subprocess import check_output

import numpy as np

import pandas as pd

import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
from plotly import tools
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode()
from subprocess import check_output
SW = pd.read_csv('../input/seattleWeather_1948-2017.csv')
SW.columns = SW.columns.str.lower()
separate = SW.date.str.split('-')
a, b, c = zip(*separate)
SW['year'] = a
SW['month'] = b
SW_year = SW['year'].unique().astype(int)

SW['avegareinday'] = (SW.tmax + SW.tmin) / 2
SW_avegareinmonth = SW.groupby([SW.year, SW.month])['avegareinday'].sum() / SW.groupby([SW.year, SW.month])['avegareinday'].count()
SW_avegareinannualy = SW_avegareinmonth.groupby('year').sum() / 12
SW_5yearmovingaverage = np.convolve(SW_avegareinannualy, np.ones((5,)) / 5, mode='valid')
from scipy.stats import linregress
linregress(SW_year, SW_avegareinannualy.values)