I have two data sets acquired simultaneously by different acquisition systems with different sampling rates. One is very regular, and the other is not. I would like to create a single dataframe containing both data sets, using the regularly spaced timestamps (in seconds) as the reference for both. The irregularly sampled data should be interpolated on the regularly spaced timestamps.
我有完全相同的情况,但我的t
列可能有重复项。
对于t重复的每一行,我想保留一个数据列最大的行
遵循原始示例:
df1:
t y1
0 0.0 0.0
1 0.5 0.5
2 1.0 1.0
3 1.0 3.0
4 1.5 1.5
5 2.0 2.0
df2:
t y2
0 0.00 0.00
1 0.34 1.02
2 1.01 3.03
3 1.40 4.20
4 1.60 4.80
5 1.70 5.10
6 2.01 6.03
df_combined:
t y1 y2
0 0.0 0.0 0.0
1 0.5 0.5 1.5
2 1.0 3.0 3.0
3 1.5 1.5 4.5
4 2.0 2.0 6.0
注意现在t=1.0,y1=3.0
我该怎么做
有三项任务:
df1
上删除重复项df2
所以这里有一个解决方案
输出:
如果你处理的是“时间戳”,那么你就必须使用datetime包,这是一个重要的个人没有重点的一个和一个重要的时间序列预测以及
相关问题 更多 >
编程相关推荐