import numpy as np
arr = np.array([range(10)])
arr = np.array([range(10), range(10, 20)])
arr[i][j]
arr[i]
new_arr = np.hstack((arr_1, arr_2))
new_arr = np.vstack((arr_1, arr_2))
arr_1, arr_2, arr_3 = np.hsplit(arr, 3)
arr_1, arr_2 = np.vsplit(arr, 2)
arr_list = arr.tolist()
arr = np.array(arr_list)
new_arr = np.delete(arr, num, axis=0)
np.save("arr.npy", arr)
np.tofile("arr.bin", arr)
np.savetxt("arr.txt", arr, delimiter=",", fmt="%d")
arr = np.load("arr.npy")
arr = np.fromfile("arr.bin", dtype = "int32")
arr = np.loadtxt("arr.txt", delimiter = ",", fmt = "%d")
import numpy as np
a = np.arange(15).reshape(3, 5)
print(a)
'''
array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14]])
'''
print(a.shape)
print(a.ndim)
print(a.dtype.name)
print(a.itemsize)
print(a.size)
print(type(a))
print(a.sum())
print(a.min())
print(a.max())
print(a.reshape(1,6))
a.sum(axis=0)
a.min(axis=1)
a.cumsum(axis=1)
print(a.ravel())
a.shape = (m, n)
a.resize((m, n))
import numpy as np
arr = np.array([1, 2, 3, 4], dtype=complex)
arr = np.zeros((3, 4))
arr = np.ones((3, 4))
arr = np.empty((3, 4))
arr = np.arange(10, 30, 5)
arr = np.linspace(0, 2, 9)
arr = np.random.random((2,3))
import numpy as np
arr_1 = np.arange(4)
arr_2 = np.arange(4, 8)
print(arr_1 - arr_2)
print(arr_1 ** 2)
print(np.sin(arr_1))
print(arr_1.dot(arr_2))
print(np.dot(arr_1, arr_2))
import numpy as np
arr = np.arange(10)
print(arr[1:4])
arr_new = arr
print(arr_new is arr)
arr_new_1 = arr.view()
print(arr_new_1 is arr)
print(arr_new_1.base is arr)
print(arr_new_1.flags.owndata)
arr_new_2 = arr.copy()
print(arr_new_2 is arr)
print(arr_new_2.base is arr)
print(arr_new_2.flags.owndata)