I would like to build a pandas random dataframe. To fulfill that purpose I need a Python function taking as arguments :
- numpy distributions
- their arguments.
For example :
distribution 1 : normal | arguments : means = 0 , standard dev = 1 , size = 100
distribution 2 : uniform | arguments : low = 0 , high = 1 , size = 100
etc...
I do not know in advance what will be the different distributions and their arguments.
The main function will then generate random samples of the distributions using each corresponding arguments.
I have tried something like :
import numpy as np
def myfun( **kwargs ) :
for k , v in kwargs.items() :
print( k )
print( v )
When I call that function with these arguments :
myfun( fun_1 = 'np.random.normal' , arg_1 = { 'loc' : 0 , 'scale' : 1 , 'size' : 7 } ,
fun_2 = 'np.random.uniform' , arg_2 = { 'low' : 0 , 'high' : 1 , 'size' : 7 } )
The output is :
fun_1
np.random.normal
arg_1
{'loc': 0, 'scale': 1, 'size': 7}
fun_2
np.random.uniform
arg_2
{'low': 0, 'high': 1, 'size': 7}
But my purpose is not to print the desired distributions and their associated parameters but to generate a sample for each distributions.