Could not understant why we used (12, 5) in In[13] for rand

Course Name: Python for Trading: Basic, Section No: 8, Unit No: 8, Unit type: Notebook

In[13]: Could not understant why we used (12, 5) in In[13] for randon no. generator.

Hi Mridul,

 

df = pd.DataFrame(np.random.randn(12, 5)*10000, columns=names, index=months)

 np.random.randn() creates an array of specified shape and fills it with the random values as per normal standard deviation. Here 12, 5 represents the shape of the array. 12 represents the number of rows, and 5 is the number of columns.



Hope that helps.