We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d154eb commit ddac0ddCopy full SHA for ddac0dd
pandas/tests/series/test_timeseries.py
@@ -432,6 +432,16 @@ def test_first_last_valid(self):
432
assert empty.last_valid_index() is None
433
assert empty.first_valid_index() is None
434
435
+ # GH20499: its preserves freq with holes
436
+ ts.index = date_range("20110101", periods=len(ts), freq="B")
437
+ ts.iloc[1] = 1
438
+ ts.iloc[-2] = 1
439
+ assert ts.first_valid_index() == ts.index[1]
440
+ assert ts.last_valid_index() == ts.index[-2]
441
+ assert ts.first_valid_index().freq == ts.index.freq
442
+ assert ts.last_valid_index().freq == ts.index.freq
443
+
444
445
def test_mpl_compat_hack(self):
446
result = self.ts[:, np.newaxis]
447
expected = self.ts.values[:, np.newaxis]
0 commit comments