Pre-filling: np.<empty|zeros|ones|full>[_like]
- filled with garbage (not clearing memory, fastest)
np.empty(SHAPE, dtype=float64)np.empty_like(ARRAY)
- filled with 0s
np.zeros(SHAPE, dtype=float64)np.zeros_like(ARRAY)
- filled with 1s
np.ones(SHAPE, dtype=float64)np.ones_like(ARRAY)
- filled with
VALUEnp.full(SHAPE, VALUE, dtype=DTYPE)np.full_like(ARRAY, VALUE)
import numpy as np
a = np.zeros((4, 4), dtype = np.int64)
a
array([[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]])