Answers for "numpy make 1 d array with same value"

1

fill np array with same value

an_array = np.full((3, 5), 8)
Posted by: Guest on June-17-2020
0

numpy create a matrix of certain value

>>> np.full((3, 5), 7)
array([[ 7.,  7.,  7.,  7.,  7.],
       [ 7.,  7.,  7.,  7.,  7.],
       [ 7.,  7.,  7.,  7.,  7.]])

>>> np.full((3, 5), 7, dtype=int)
array([[7, 7, 7, 7, 7],
       [7, 7, 7, 7, 7],
       [7, 7, 7, 7, 7]])
Posted by: Guest on October-02-2020

Code answers related to "numpy make 1 d array with same value"

Python Answers by Framework

Browse Popular Code Answers by Language