How do you generate integer starts for minute windows?

arange advances by a fixed step. With a positive step it emits values strictly below the stop.

numpy.arange in practice

Quarter-hour windows start at minutes 0, 15, 30 and 45. Floating steps introduce rounding near the boundary. Generate by count when the number of points is the requirement.

import numpy as np
np.arange(0,60,15)

Result [0, 15, 30, 45]

中文

如何生成分钟窗口的整数起点?

arange 从起点以固定步长取值,正步长时只保留小于终点的项。

numpy.arange 算例

将前一小时切成 15 分钟片段,起点为 0、15、30、45。对浮点步长,舍入会影响边界,已知点数时可直接按点数生成。

import numpy as np
np.arange(0,60,15)

结果 [0, 15, 30, 45]

References / 参考来源

Keep reading / 继续阅读