np.linspace(0,10,11)
np.linspace函数的意思是,创建一个等差数列。
np.linspace参数:
numpy.linspace(start, stop, num=50,
endpoint=True, retstep=False, dtype=None, axis=0)
start:返回样本数据开始点
stop:返回样本数据结束点
num:生成的样本数据量长度,默认为50
endpoint:True则包含stop;False则不包含stop
retstep:If True, return (samples, step), where step is the spacing between samples.(即如果为True则结果会给出数据间隔)
dtype:输出数组类型,默认是float
axis:0(默认)或-1
index = np.linspace(0,10,5,dtype=int)
print( index)
# 输出
# [ 0 2 5 7 10]