Python – numpy.arange()

Being a linear sequence generator, the numpy.arange() function is used to generate a sequence of numbers in linear space with a uniform step size.

作为线性序列生成器, numpy.arange()函数用于在线性空间中以均匀步长生成数字序列。

This is similar to another function, numpy.linspace(), which also generates a linear sequence with a uniform step size.

这类似于另一个函数numpy.linspace() ,该函数还生成具有均匀步长的线性序列。

Let’s understand how we can use this function to generate different sequences.

让我们了解如何使用此函数生成不同的序列。



句法 (Syntax)

Format:

格式:


array = numpy.arange(start, stop, step, dtype=None)

Here,

这里,

  • start -> The starting point (included) of the range, which is set to 0 by default.

    start >范围的起点( 包括在内 ),默认情况下设置为0
  • stop -> The ending point (excluded) of the range

    stop ->范围的终点( 不包括
  • step -> The step size of the sequence, which is set to 1 by default. This can be any real number except Zero.

    step >序列的步长,默认设置为1。 外,它可以是任何实数。
  • dtype -> The type of the output array. If dtype is not given (or provided as None), the datatype will be inferred from the type of other input arguments.

    dtype >输出数组的类型。 如果未给出dtype (或作为None提供),则将从其他输入参数的类型推断出数据类型。

Let us take a simple example to understand this:

让我们举一个简单的例子来理解这一点:

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值