Creating data that follows a specific data distribution I have a variable z which has around 3000 values between 0.0 and 0.5.
I have plotted here z in the y-axis and 3000 evenly spaced numbers over the interval 0.0 and 0.5 in the x-axis so that one can see my data distribution.

I want to create another set of data of 100,000 points, that follows the distribution of my original data, i.e z. 
How can I do this? Preferably in Python? 
 A: Numerically you have to choose a nonnegative function $f$ with integral 1. This is the density of your probabiliy distribution, and statistically, this part is the most difficult. You can find a lot about density estimation. Then you invert $F(x):=\int_{-\infty}^xf(z)\mathrm{d}z$. Next you generate a pseudo random number, say $y$, from the interval $[0,1]$. random.uniform in Python does this step. Your desired random numbers then are $F^{-1}(y)$.
Note however that scientifically this is rarely useful. The density you chose to fit is arbitrary, right? Why not take something different? It will fit the data better or worse, but you don't know what this means because typically you don't know the true distribution of your data. This will happen with all choices of beautiful density functions.
So another approach is to chose the value of any of your observations with equal probability: z[random.choice(1:2700)] These random numbers will have exactly the distribution you observed. This approach is called resampling. The drawback of this approach is that the tails of your distribution are underestimated. Even if extreme observations have a high probability to occur in the real distribution, the probability to get an observation more extreme than in your original data is 0. If this is crucial, don't choose this approach.
