Articles → NUMPY → Arrays of ones in NumPy

Arrays of ones in NumPy






Purpose





Example




import numpy as np

np.ones(5) # Single dimensional array


Picture showing the one dimensional array in numpy

Click to Enlarge

import numpy as np

np.ones((2, 3)) # Two dimensional array


Picture showing the two dimensional array in numpy

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, March 20, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250