numpy.random.zipf(a, size=None)

Draw samples from a Zipf distribution.

Samples are drawn from a Zipf distribution with specified parameter (a), where a > 1.

The zipf distribution (also known as the zeta distribution) is a continuous probability distribution that satisfies Zipf’s law, where the frequency of an item is inversely proportional to its rank in a frequency table.


a : float

parameter, > 1.

size : {tuple, int}

Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn.


samples : {ndarray, scalar}

The returned samples are greater than or equal to one.

See also

probability density function, distribution or cumulative density function, etc.


The probability density for the Zipf distribution is

p(x) = \frac{x^{-a}}{\zeta(a)},

where \zeta is the Riemann Zeta function.

Named after the American linguist George Kingsley Zipf, who noted that the frequency of any word in a sample of a language is inversely proportional to its rank in the frequency table.


[R263]Weisstein, Eric W. “Zipf Distribution.” From MathWorld–A Wolfram Web Resource.
[R264]Wikipedia, “Zeta distribution”,
[R265]Wikipedia, “Zipf’s Law”,
[R266]Zipf, George Kingsley (1932): Selected Studies of the Principle of Relative Frequency in Language. Cambridge (Mass.).


Previous topic


Next topic


This Page