Answers for "numpy full"

1

numpy full

import numpy as np

# Creates a 5x5 2d matrix with values True
output = np.full((5,5), True)
# Proof
print(output)
#[[ True  True  True  True  True]
# [ True  True  True  True  True]
# [ True  True  True  True  True]
# [ True  True  True  True  True]
# [ True  True  True  True  True]]
Posted by: Guest on October-22-2020
0

np.full

>>> np.full((2, 2), np.inf)
array([[inf, inf],
       [inf, inf]])
>>> np.full((2, 2), 10)
array([[10, 10],
       [10, 10]])
Posted by: Guest on May-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language