Skip to content

Instantly share code, notes, and snippets.

@tomatau
Last active August 29, 2015 14:25
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 tomatau/8153c7cb1b410c34981a to your computer and use it in GitHub Desktop.
Save tomatau/8153c7cb1b410c34981a to your computer and use it in GitHub Desktop.
Thinkful Unit 2 Lesson 2.3
from scipy import stats
# import matplotlib.pyplot as plt
import pandas as pd
import collections
loansData = pd.read_csv(
'https://spark-public.s3.amazonaws.com/dataanalysis/loansData.csv'
)
loansData.dropna(inplace=True)
freq = collections.Counter(loansData['Open.CREDIT.Lines'])
# plt.figure()
# plt.bar(freq.keys(), freq.values(), width=1)
# plt.show()
chi, p = stats.chisquare(freq.values())
print p, chi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment