<p>Have you considered using a GAN (generative adversarial network)? Takes a bit more effort than just using a predefined function, but essentially it does exactly what you are hoping to do. Here's the original paper: <a href="https://arxiv.org/abs/1406.2661" rel="nofollow noreferrer">https://arxiv.org/abs/1406.2661</a></p>
<p>There are many PyTorch/Tensorflow codes that you can download and fit to your purposes, for example this one: <a href="https://github.com/eriklindernoren/PyTorch-GAN" rel="nofollow noreferrer">https://github.com/eriklindernoren/PyTorch-GAN</a></p>
<p>Here is also a blog post I found quite helpful with an introduction to GANs. <a href="https://medium.com/ai-society/gans-from-scratch-1-a-deep-introduction-with-code-in-pytorch-and-tensorflow-cb03cdcdba0f" rel="nofollow noreferrer">https://medium.com/ai-society/gans-from-scratch-1-a-deep-introduction-with-code-in-pytorch-and-tensorflow-cb03cdcdba0f</a></p>
<p>Maybe GAN is overkill for this problem and there are simpler methods for upscaling the sample size, in which case I'd be interested to learn about them.</p>
How can I generate samples from a non-normal multivariable distribution in Python?
<p>I have an input dataframe df_input with 10 variables and 100 rows. This data are not normal distributed.
I would like to generate an output dataframe with 10 variables and 10,000 rows, such that the covariance matrix and mean of the new dataframe are the same as those of the original one. The output variables should not be normal distributed, but rather have a distribution similar to the input variables.
That is:
Cov(df_output) = Cov(df_input) and
mean(df_ouput) = mean(df_input)
Is there a Python function that does it?</p>
<p>Note: np.random.multivariate_normal(mean_input,Cov_input,10000) does almost this, but the output variables are normal distributed, whereas I need them to have the same (or similar) distribution as the input.</p>