如何获得微秒的cumsum值?

时间:2018-05-16 08:09:35

标签: pandas time cumsum

如何获得微秒秒的cumsum值?

它低于输入数据

time                     A   B
2018-04-04 00:01:52.474 0.0 0.0 
2018-04-04 00:01:52.676 0.0 0.0
2018-04-04 00:01:52.692 0.0 0.0
2018-04-04 00:01:52.754 1.0 0.0
2018-04-04 00:01:52.817 1.0 0.0
2018-04-04 00:01:52.848 1.0 0.0
2018-04-04 00:01:52.895 1.0 0.0
2018-04-04 00:01:53.051 1.0 0.0
2018-04-04 00:01:53.082 1.0 0.0 
2018-04-04 00:01:53.160 1.0 0.0 
2018-04-04 00:01:53.316 1.0 1.0
2018-04-04 00:01:53.332 1.0 1.0

输出数据:

我想在数据帧

中获取字符时间获取值
time                     A   B  cumsum_Time
2018-04-04 00:01:52.474 0.0 0.0   NaN
2018-04-04 00:01:52.676 0.0 0.0   NaN
2018-04-04 00:01:52.692 0.0 0.0   NaN
2018-04-04 00:01:52.754 1.0 0.0   0.0
2018-04-04 00:01:52.817 1.0 0.0   0.04~
2018-04-04 00:01:52.848 1.0 0.0   0.09~
2018-04-04 00:01:52.895 1.0 0.0   0.14~
2018-04-04 00:01:53.051 1.0 0.0   0.32~
2018-04-04 00:01:53.082 1.0 0.0   0.35~
2018-04-04 00:01:53.160 1.0 0.0   0.43~
2018-04-04 00:01:53.316 1.0 1.0   0.52~
2018-04-04 00:01:53.332 1.0 1.0   NaN 
...

输出2更改值

2018/04/04 00:01:52:754 1.0 0.0  NaN  0       this1
2018/04/04 00:01:52:817 1.0 0.0  1    0.06
2018/04/04 00:01:52:848 1.0 0.0  1    0.09
2018/04/04 00:01:52:895 1.0 0.0  1    0.14
2018/04/04 00:01:53:051 1.0 0.0  1    0.303
2018/04/04 00:01:53:082 1.0 0.0  1    0.323
2018/04/04 00:01:53:160 1.0 0.0  1    0.415
2018/04/04 00:01:53:316 1.0 1.0  1    0.562   this2

0 个答案:

没有答案