numpy full

Solutions on MaxInterview for numpy full by the best coders in the world

showing results for - "numpy full"
Matthieu
01 Mar 2019
1import numpy as np
2
3# Creates a 5x5 2d matrix with values True
4output = np.full((5,5), True)
5# Proof
6print(output)
7#[[ True  True  True  True  True]
8# [ True  True  True  True  True]
9# [ True  True  True  True  True]
10# [ True  True  True  True  True]
11# [ True  True  True  True  True]]
Amie
03 Jan 2019
1>>> np.full((2, 2), np.inf)
2array([[inf, inf],
3       [inf, inf]])
4>>> np.full((2, 2), 10)
5array([[10, 10],
6       [10, 10]])
7