@@ -2878,16 +2878,22 @@ def test_upsampling_ohlc(self, freq, period_mult, kind):
2878
2878
result = s .resample (freq , kind = kind ).ohlc ()
2879
2879
assert_frame_equal (result , expected )
2880
2880
2881
+ @pytest .mark .parametrize ('periods, values' ,
2882
+ [([pd .NaT , '1970-01-01 00:00:00' , pd .NaT ,
2883
+ '1970-01-01 00:00:02' , '1970-01-01 00:00:03' ],
2884
+ [2 , 3 , 5 , 7 , 11 ]),
2885
+ ([pd .NaT , pd .NaT , '1970-01-01 00:00:00' , pd .NaT ,
2886
+ pd .NaT , pd .NaT , '1970-01-01 00:00:02' ,
2887
+ '1970-01-01 00:00:03' , pd .NaT , pd .NaT ],
2888
+ [1 , 2 , 3 , 5 , 6 , 8 , 7 , 11 , 12 , 13 ])])
2881
2889
@pytest .mark .parametrize ('freq, expected_values' ,
2882
2890
[('1s' , [3 , np .NaN , 7 , 11 ]),
2883
2891
('2s' , [3 , int ((7 + 11 ) / 2 )]),
2884
2892
('3s' , [int ((3 + 7 ) / 2 ), 11 ])])
2885
- def test_resample_with_nat (self , freq , expected_values ):
2893
+ def test_resample_with_nat (self , periods , values , freq , expected_values ):
2886
2894
# GH 13224
2887
- index = PeriodIndex ([pd .NaT , '1970-01-01 00:00:00' , pd .NaT ,
2888
- '1970-01-01 00:00:02' , '1970-01-01 00:00:03' ],
2889
- freq = 'S' )
2890
- frame = DataFrame ([2 , 3 , 5 , 7 , 11 ], index = index )
2895
+ index = PeriodIndex (periods , freq = 'S' )
2896
+ frame = DataFrame (values , index = index )
2891
2897
2892
2898
expected_index = period_range ('1970-01-01 00:00:00' ,
2893
2899
periods = len (expected_values ), freq = freq )
0 commit comments