且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

pandas 滚动中值以获取重复的时间序列数据

更新时间:2023-11-23 15:51:46

目前没有什么可以阻止您的事情:

There's nothing really to stop you right now:

In [17]: idf = df.set_index(['tag', 'epochTimeMS'], verify_integrity=False).sort_index()

In [18]: idf
Out[18]: 
                     event  timeTakenMS
tag  epochTimeMS                       
tag1 1331782842381  event2          436
     1331782842801  event1           16
     1331782842801  event1           17
tag2 1331782841535  event1         1278

In [20]: idf.ix['tag1']
Out[20]: 
                event  timeTakenMS
epochTimeMS                       
1331782842381  event2          436
1331782842801  event1           16
1331782842801  event1           17

通过时间戳

访问特定值将导致异常(如您所述,这将得到改善),但是您当然可以使用数据.现在,如果您想要定长(时空)窗口,目前还不太支持,但是我在这里创建了一个问题:

Accessing specific values by timestamp will cause an exception (this is going to be improved, as you mention), but you can certainly work with the data. Now, if you want a fixed-length (in time space) window, that's not supported very well yet but I created an issue here:

https://github.com/pydata/pandas/issues/936

如果您可以在邮件列表中说出您的应用程序中的API要求,这对我和他们都将有所帮助,因为我们现在正在积极地开发时间序列功能.

If you could speak up on the mailing list about your API requirements in your application it would be helpful for me and the guys since we're actively working on the time series capabilities right now.