In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
import numpy as np
In [ ]:
a = np.array([2,3,4])
In [ ]:
a
In [ ]:
a.dtype
In [ ]:
In [ ]:
In [ ]:
a * 6
In [ ]:
In [ ]:
In [ ]:
a >= 3
In [ ]:
In [ ]:
In [ ]:
m = np.array([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
In [ ]:
In [ ]:
In [ ]:
m
In [ ]:
In [ ]:
In [ ]:
m * 5
In [ ]:
In [ ]:
In [ ]:
m[0]
In [ ]:
In [ ]:
In [ ]:
m[:, 1]
In [ ]:
In [ ]:
In [ ]:
np.linspace(0, 1, 9)
In [ ]:
In [ ]:
In [ ]:
np.zeros([3,3])
In [ ]:
In [ ]:
In [ ]:
a = np.arange(0, 2 ** 20)
In [ ]:
l = range(0, 2 ** 20)
In [ ]:
len(a), len(l)
In [ ]:
In [ ]:
a
In [ ]:
In [ ]:
a * a
In [ ]:
In [ ]:
%%timeit -n 3
[i*i for i in l]
In [ ]:
%%timeit -n 100
a * a
In [ ]:
In [ ]: