``````

In [1]:

import numpy as np

``````
``````

In [2]:

a_int = np.arange(6).reshape((2,3))
print(a_int)

``````
``````

[[0 1 2]
[3 4 5]]

``````
``````

In [3]:

a_float = np.arange(6).reshape((2,3)) / 10
print(a_float)

``````
``````

[[ 0.   0.1  0.2]
[ 0.3  0.4  0.5]]

``````
``````

In [4]:

print(np.zeros_like(a_int))

``````
``````

[[0 0 0]
[0 0 0]]

``````
``````

In [5]:

print(np.zeros_like(a_float))

``````
``````

[[ 0.  0.  0.]
[ 0.  0.  0.]]

``````
``````

In [6]:

print(np.zeros_like(a_int, dtype=np.float))

``````
``````

[[ 0.  0.  0.]
[ 0.  0.  0.]]

``````
``````

In [7]:

print(np.ones_like(a_int))

``````
``````

[[1 1 1]
[1 1 1]]

``````
``````

In [8]:

print(np.ones_like(a_float))

``````
``````

[[ 1.  1.  1.]
[ 1.  1.  1.]]

``````
``````

In [9]:

print(np.ones_like(a_int, dtype=np.float))

``````
``````

[[ 1.  1.  1.]
[ 1.  1.  1.]]

``````
``````

In [10]:

print(np.full_like(a_int, 100))

``````
``````

[[100 100 100]
[100 100 100]]

``````
``````

In [11]:

print(np.full_like(a_float, 100))

``````
``````

[[ 100.  100.  100.]
[ 100.  100.  100.]]

``````
``````

In [12]:

print(np.full_like(a_int, 0.123))

``````
``````

[[0 0 0]
[0 0 0]]

``````
``````

In [13]:

print(np.full_like(a_float, 0.123))

``````
``````

[[ 0.123  0.123  0.123]
[ 0.123  0.123  0.123]]

``````
``````

In [14]:

print(np.full_like(a_int, 0.123, dtype=np.float))

``````
``````

[[ 0.123  0.123  0.123]
[ 0.123  0.123  0.123]]

``````