[Numpy-discussion] Documenting `zipf`

Stéfan van der Walt stefan@sun.ac...
Thu Jul 24 10:15:46 CDT 2008


Hi,

Does anybody know how Zipf's law or how Zipfian distributions work,
and how they relate
to NumPy's `np.random.zipf`?  I'm afraid I can't make head or tail of
these results:

In [106]: np.random.zipf(2, size=(10))
Out[106]: array([ 1,  1,  1, 29,  1,  1,  1,  1,  1,  2])

(8x1, 1x2, 1x29)

In [107]: np.random.zipf(2, size=(10))
Out[107]: array([75,  1,  1,  3,  1,  1,  1,  1,  1,  4])

(7x1, 1x3, 1x4, 1x75)

In [108]: np.random.zipf(2, size=(10))
Out[108]: array([ 6, 17,  2,  1,  1,  2,  1, 20,  1,  2])

(4x1, 3x2, 1x6, 1x17, 1x20)

Thanks!
Stéfan


More information about the Numpy-discussion mailing list