我有一个pandas数据帧,其中索引是一个时间戳,列是元组,例如:
date, (height, t), (height, t-1), (weight, t), (weight, t-1), ...
9/15/2019, 55, 54, 170, 168, ...
...
9/17/2019, 40, 39, 120, 119, ...
我想以矩阵的形式获取每一行的值,以使时间步长从过去到现在是有序的:
[
[height t-1, height t, ...]
[weight t-1, weight t, ...],
],
...
[
]
在这种情况下,应该是
[[54, 55, ...]
[168,170, ...]],
...
[[39, 40, ...],
[119,120, ...]]
解决方案对于功能的数量和时间步的数量必须灵活。我该怎么做?