的整数系列I有如下的数据帧:转换浮子系列到大熊猫
In [31]: rise_p
Out[31]:
time magnitude
0 1379945444 156.627598
1 1379945447 1474.648726
2 1379945448 1477.448999
3 1379945449 1474.886202
4 1379945699 1371.454224
现在,我想组行,其在一分钟之内。所以我把时间序列与100分开。我得到这个:
In [32]: rise_p/100
Out[32]:
time magnitude
0 13799454.44 1.566276
1 13799454.47 14.746487
2 13799454.48 14.774490
3 13799454.49 14.748862
4 13799456.99 13.714542
如上所述,我想创建基于时间的组。因此,预期的子组将是时间为13799454
和13799456
的行。我这样做:
如何转换ts
为整数系列自INT()不采取系列或列表作为参数?熊猫有什么方法可以做到这一点吗?
使用'astype()'是绝对正确的,但是避免列表理解会更好。像'ts ['time'] =(ts.time/100).astype('int')',然后用'ts.grouby('time')'进行分组等等...... –
Yes agree,avoid the列表理解会更好,将编辑我的答案来反映。 – drexiya