Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 提取时间序列中缺失值的窗口_Python_Pandas_Time Series - Fatal编程技术网

Python 提取时间序列中缺失值的窗口

Python 提取时间序列中缺失值的窗口,python,pandas,time-series,Python,Pandas,Time Series,我有一个熊猫的时间序列,缺少一些值: sensor_1 date_format 2020-01-31 00:00:00 22.029828 2020-01-31 02:00:00

我有一个熊猫的时间序列,缺少一些值:

                                  sensor_1  
date_format                                                                                                  
2020-01-31 00:00:00               22.029828     
2020-01-31 02:00:00               NA                
2020-01-31 04:00:00               NA              
2020-01-31 06:00:00               22.045436           
2020-01-31 08:00:00               NA                
2020-01-31 10:00:00               NA               
2020-01-31 12:00:00               NA            
2020-01-31 14:00:00               22.525116    
我想做的是将每个缺少值的窗口的开始和结束时间戳作为元组列表:

desired_output = [(Timestamp('2020-01-31 02:00:00'), Timestamp('2020-01-31 04:00:00')), (Timestamp('2020-01-31 08:00:00'), Timestamp('2020-01-31 12:00:00'))]
你知道我该怎么做吗? 我已经检查了几个栈柱,但没有一个适合我的用例

谢谢