Skip to content

Instantly share code, notes, and snippets.

@sachinsdate
Last active June 25, 2019 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sachinsdate/1011ee0886b0d93777842b5acad8d36e to your computer and use it in GitHub Desktop.
Save sachinsdate/1011ee0886b0d93777842b5acad8d36e to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import pandas as pd
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
import seaborn as sns
df = pd.read_csv('boston_monthly_tmax_1998_2019.csv', header=0, infer_datetime_format=True, parse_dates=[0], index_col=[0])
df.plot(marker='.')
plt.show()
for i in range(1, 12+1):
df['TMINUS' + str(i)] = df['Monthly Average Maximum'].shift(i)
for i in range(1, 12+1):
ax = plt.subplot(4, 3, i)
ax.set_title('LAG ' + str(i), fontdict={'fontsize': 10})
plt.scatter(x=df['Monthly Average Maximum'].values, y=df['TMINUS' + str(i)].values, marker='.')
plt.show()
corr = df.corr()
sns.heatmap(corr, xticklabels=corr.columns,yticklabels=corr.columns)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment