@@ -2830,16 +2830,22 @@ def test_upsampling_ohlc(self, freq, period_mult, kind):
2830
2830
result = s .resample (freq , kind = kind ).ohlc ()
2831
2831
assert_frame_equal (result , expected )
2832
2832
2833
+ @pytest .mark .parametrize ('periods, values' ,
2834
+ [([pd .NaT , '1970-01-01 00:00:00' , pd .NaT ,
2835
+ '1970-01-01 00:00:02' , '1970-01-01 00:00:03' ],
2836
+ [2 , 3 , 5 , 7 , 11 ]),
2837
+ ([pd .NaT , pd .NaT , '1970-01-01 00:00:00' , pd .NaT ,
2838
+ pd .NaT , pd .NaT , '1970-01-01 00:00:02' ,
2839
+ '1970-01-01 00:00:03' , pd .NaT , pd .NaT ],
2840
+ [1 , 2 , 3 , 5 , 6 , 8 , 7 , 11 , 12 , 13 ])])
2833
2841
@pytest .mark .parametrize ('freq, expected_values' ,
2834
2842
[('1s' , [3 , np .NaN , 7 , 11 ]),
2835
2843
('2s' , [3 , int ((7 + 11 ) / 2 )]),
2836
2844
('3s' , [int ((3 + 7 ) / 2 ), 11 ])])
2837
- def test_resample_with_nat (self , freq , expected_values ):
2845
+ def test_resample_with_nat (self , periods , values , freq , expected_values ):
2838
2846
# GH 13224
2839
- index = PeriodIndex ([pd .NaT , '1970-01-01 00:00:00' , pd .NaT ,
2840
- '1970-01-01 00:00:02' , '1970-01-01 00:00:03' ],
2841
- freq = 'S' )
2842
- frame = DataFrame ([2 , 3 , 5 , 7 , 11 ], index = index )
2847
+ index = PeriodIndex (periods , freq = 'S' )
2848
+ frame = DataFrame (values , index = index )
2843
2849
2844
2850
expected_index = period_range ('1970-01-01 00:00:00' ,
2845
2851
periods = len (expected_values ), freq = freq )
0 commit comments