Reputation: 7500
I have a couple of questions:
1). If I need to generate a 1000x100 data points(dataset), with each co-ordinate having mean 0 and 1(marginal distribution), what's the best way to do that in numpy or pandas if possible?
2). Generate a multivariate data points 100x1000.
I can do these by creating 100 list of 1000 dimensions each with a univariate distribution(mean 0 and 1) and can then concat it together in numpy. But I think that would be a very long approach. I am looking for a more pythonic way. Also I would appreciate if a general approach could be given which could help me generate any distribution for a NxD dimensional dataset.
Upvotes: 1
Views: 481
Reputation: 16269
Numpy's random number generators will fill any shape you want:
import numpy.random as nr
nr.seed()
nr.normal(0,1,(2,3,4))
Upvotes: 1