Pandas rolling median for duplicate time series data

前端 未结 1 523
鱼传尺愫
鱼传尺愫 2021-01-06 06:44

I see that Pandas does not allow duplicate time series indexes yet (https://github.com/pydata/pandas/issues/643), but will be added soon. I am wondering if there is a good

相关标签:
1条回答
  • 2021-01-06 07:35

    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

    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.

    0 讨论(0)
提交回复
热议问题