How do sensor snapshots acquire a time axis?

stack combines equal-shaped arrays along a new axis whose index can identify the time of each snapshot.

numpy.stack in practice

Each reading has temperature and humidity. Stacking two readings on axis zero produces two rows. Align fields before stacking if one reading lacks a measurement.

import numpy as np
np.stack(([20,60],[21,65]), axis=0)

Result [[20, 60], [21, 65]]

中文

如何把多个传感器快照叠成时间轴?

stack 沿新轴组合等形数组。新轴的下标可以标识快照来自哪个时刻。

numpy.stack 算例

两次记录均包含温度和湿度,沿轴零叠放得到两行。若某次漏了一项,须先对齐字段才能装入同一张表。

import numpy as np
np.stack(([20,60],[21,65]), axis=0)

结果 [[20, 60], [21, 65]]

References / 参考来源

Keep reading / 继续阅读