Answers for "python array with same value"

1

create an array with same value python

>> import numpy as np
>> fives = np.repeat(5, 10)
#This creates an array of the number 5 repeated 10 times.
Posted by: Guest on June-28-2021
2

np array n same values

>>> 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 June-02-2020

Code answers related to "python array with same value"

Python Answers by Framework

Browse Popular Code Answers by Language