0

I am getting a wierd error.... this doesn't happen if I use np.random.random instead of np.random.randint

>>> import numpy as np
>>> import scipy.stats as stats
>>> rdata = np.random.randint(5000)
>>> skew = stats.skew(rdata)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/scipy/stats/stats.py", line 989, in skew
    n = a.shape[axis]
IndexError: tuple index out of range
igauravsehrawat
  • 3,696
  • 3
  • 33
  • 46
baconwichsand
  • 1,161
  • 2
  • 13
  • 31

1 Answers1

1

Take a closer look at the docstrings for numpy.random.randint and numpy.random.random. numpy.random.randint(5000) returns a single random integer between 0 and 4999 (inclusive). numpy.random.random(5000) returns an array of 5000 samples from the uniform distibution on 0 <= x < 1.

Warren Weckesser
  • 110,654
  • 19
  • 194
  • 214