摘要:
>>> import numpy as np >>> L = np.random.random(100) >>> L array([0.82846513, 0.19136857, 0.27040895, 0.56103442, 0.90238039, 0.85178834, 0.41808196, 阅读全文
摘要:
>>> import numpy as np >>> np.zeros(10,dtype=int) array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) >>> np.zeros((3,5)) array([[0., 0., 0., 0., 0.], [0., 0., 0., 阅读全文
摘要:
生成数组 >>> import numpy as np >>> np.random.randn(10) array([ 0.52712347, -1.65888503, -1.00390235, 1.01367036, -0.15752943, -2.2986508 , -0.00966312, - 阅读全文
摘要:
%run %run C:\Users\User\Desktop\hello.py hello world %timeit %timeit L = [i for i in range(1000)] 29.1 µs ± 2.98 µs per loop (mean ± std. dev. of 7 ru 阅读全文
摘要:
import numpy as np x = np.arange(16) index = [3,5,8] x[index] array([3, 5, 8]) X = x.reshape(4,-1) X array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 阅读全文
摘要:
数组的创建 数组的访问 数组的合并 数组的分割 数组创建 >>> import numpy as np 创建一维数组 >>> x = np.arange(10) >>> x array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) 创建二维数组 >>> X = np.arange( 阅读全文