diff --git a/pandas/tests/test_resample.py b/pandas/tests/test_resample.py index e9941163961325..2bc36388d9da97 100644 --- a/pandas/tests/test_resample.py +++ b/pandas/tests/test_resample.py @@ -2830,16 +2830,22 @@ def test_upsampling_ohlc(self, freq, period_mult, kind): result = s.resample(freq, kind=kind).ohlc() assert_frame_equal(result, expected) + @pytest.mark.parametrize('periods, values', + [([pd.NaT, '1970-01-01 00:00:00', pd.NaT, + '1970-01-01 00:00:02', '1970-01-01 00:00:03'], + [2, 3, 5, 7, 11]), + ([pd.NaT, pd.NaT, '1970-01-01 00:00:00', pd.NaT, + pd.NaT, pd.NaT, '1970-01-01 00:00:02', + '1970-01-01 00:00:03', pd.NaT, pd.NaT], + [1, 2, 3, 5, 6, 8, 7, 11, 12, 13])]) @pytest.mark.parametrize('freq, expected_values', [('1s', [3, np.NaN, 7, 11]), ('2s', [3, int((7 + 11) / 2)]), ('3s', [int((3 + 7) / 2), 11])]) - def test_resample_with_nat(self, freq, expected_values): + def test_resample_with_nat(self, periods, values, freq, expected_values): # GH 13224 - index = PeriodIndex([pd.NaT, '1970-01-01 00:00:00', pd.NaT, - '1970-01-01 00:00:02', '1970-01-01 00:00:03'], - freq='S') - frame = DataFrame([2, 3, 5, 7, 11], index=index) + index = PeriodIndex(periods, freq='S') + frame = DataFrame(values, index=index) expected_index = period_range('1970-01-01 00:00:00', periods=len(expected_values), freq=freq)