""" 创建ndarray数组(linespace,arange,uniform,normal) """ import numpy as np print("linespace:", np.linspace(0, 100, 5)) # 等间隔的序列 print("arange:", np.arange(10, 50, 10)) # 每间隔10 print("uniform:", np.random.uniform(-1,1, 5))#均匀分布 print("normal:", np.random.normal(loc=1.75, scale=0.1, size=5))# 正太分布
linespace: [ 0. 25. 50. 75. 100.] arange: [10 20 30 40] uniform: [-0.93105165 0.95832368 0.57355316 -0.51174497 -0.71620873] normal: [1.78206469 1.94835097 1.78042805 1.72402925 1.83369754]
原文地址:https://www.cnblogs.com/jumpkin1122/p/11503540.html
时间: 2024-10-08 17:58:02