I'm trying to create a simple probability density function(pdf) graph using data from one column of a csv file using csv dictreader, matplotlib and numpy...
Is there an easy way to use CSV DictReader combined with numpy arrays? Below is code that doesn't work. The error message is TypeError: len() of unsized object, which I'm guessing is related to the fact that my data is not in numpy array format? Also my data has negative and positive numbers. Thanks in advance!
import easygui
import csv
import scipy.stats
from numpy import*
from pylab import*
filename= easygui.fileopenbox(msg='Altitude outlier graph', title='select file', filetypes=['*.csv'], default='X:\\')
alt_file=open(filename)
x=[]
for row in csv.DictReader(alt_file):
x.append(float(row['Dist_90m(nmi)']))
a=scipy.stats.pdf_moments(x)
prob, bins, patches= hist(a, 10,align='left',facecolor='green')
ylabel('probability density function')
show()