我有一个时间序列数据如下:
print(df)
ric datel timel val
0 xyz 2017-01-01 09:00:00 2
1 xyz 2017-01-01 09:04:00 5
2 xyz 2017-01-01 09:37:00 6
现在我必须填充丢失的时间戳,直到09:45:00
。在
预期产量:
^{pr2}$我的尝试:
df1=df.resample("1 min", on ='datel').first()
其输出为:
ric datel timel val
datel
2017-01-01 xyz 2017-01-01 09:00:00 2
也尝试过使用pd.date_range
,但它主要用于datetime列。
我有两个不同的列日期和时间。有没有办法不把date和column合并到datetime中来实现这一点?在
在生成带有日期范围的日期之后,您可以使用类似于下面的函数来拆分它。在
返回值可以输入df
从日期时间导入日期时间
主要思想是由^{} 创建的
time
使用{a1}:与
^{pr2}$resample
相似的溶液:相关问题 更多 >
编程相关推荐