len() of unsized object - ks test

Jamie Mitchell jamiemitchell1604 at gmail.com
Fri Apr 25 10:07:54 EDT 2014


Hello all,

I am trying to perform a Kolmogorov-Smirnov test in Python but I'm having a few difficulties.

# My files are netCDF so I import them as follows:

control=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swest_concatannavg_1D.nc','r')

# The string is simply a 1D array

# Then performing the ks test:

kstest(control,'norm')

# I then get the following error:

File "<stdin>", line 1, in <module>
  File "/usr/local/sci/lib/python2.7/site-packages/scipy/stats/stats.py", line 3413, in kstest
    N = len(vals)
TypeError: len() of unsized object

Any ideas on why this isn't working would be great.

Thanks,

Jamie



More information about the Python-list mailing list