小编use*_*333的帖子

pandas如何通过一行生成多行

时间戳速度

 1. 2014-12-04 12:30:10  104,105,105,106,106,106,99,90
 2. 2014-12-04 12:32:19  86,86,87,88,88,89,90,92,93,95,97,100,102,104,1...
 3. 2014-12-04 12:32:58  110,110,110,110,110,110,110,110,110,110,110,10..
Run Code Online (Sandbox Code Playgroud)

DatetimeIndex: 24 个条目,2014-12-04 12:30:10 到 2014-12-04 12:29:13 数据列(共 1 列):速度 24 个非空对象

我想像这样传输 DataFrame:

timestamp                                              speeds               

 1. 2014-12-04 12:30:10                                   104
 2. 2014-12-04 12:30:11                                   105
 3. 2014-12-04 12:30:12                                   105
 4. ....
 5. 2014-12-04 12:32:17                                   90
 6. 2014-12-04 12:32:18                    88 (resample and fill the timestamp and the mean speed value)
 7. 2014-12-04 12:32:19                                   86
 8. 2014-12-04 12:32:20                                   86
 9. 2014-12-04 12:32:21                                   87
Run Code Online (Sandbox Code Playgroud)

有简单的功能可以做到这一点吗?或者只逐行迭代并解析字段?

python pandas

5
推荐指数
1
解决办法
8716
查看次数

标签 统计

pandas ×1

python ×1