How to initialize 2D numpy array with identical number in Python

1 Answer

0 votes
import numpy as np

arr = np.full((3, 4), 7)

print(arr)
 
  
 
'''
run:
 
[[7 7 7 7]
 [7 7 7 7]
 [7 7 7 7]]
 
'''

 



answered Jan 27, 2020 by avibootz
...