【发布时间】:2021-11-18 23:43:43
【问题描述】:
我在一个数组中有 5 列是 DateTime 类型的值。每列有 100k+ 个值
这些值是从 2015 年 1 月 15 日 00:30 到 2020 年 12 月 31 日 23:00 以 30 分钟为增量的时间线的 DateTime。
基本上,我想要做的是遍历数组中的值,并检查当前值是否与最后一个值相差 30 分钟的时间步长。在具有列的数组中,这将是当前正在调查的值之上的值
可能有几种方法可以做到这一点,但我提供了一个伪代码示例来说明我的想法
for row in _the_whole_array :
for cell in row:
if cell == to the 30 minute timestep of the cell above it
continue iterating
else:
store that value
return the smallest timestep found, and the biggest timestep found
我查看了 for 循环以及 nditer,但在迭代日期时间时遇到错误,我还想知道如何找到高于当前单元格值的单元格值。
非常感谢任何帮助
【问题讨论】:
标签: python numpy numpy-ndarray array-broadcasting