MCPcopy
hub / github.com/pandas-dev/pandas / test_fillna

Method test_fillna

pandas/tests/series/methods/test_fillna.py:65–81  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

63 tm.assert_frame_equal(filled2, expected)
64
65 def test_fillna(self):
66 ts = Series(
67 [0.0, 1.0, 2.0, 3.0, 4.0], index=date_range("2020-01-01", periods=5)
68 )
69
70 tm.assert_series_equal(ts, ts.ffill())
71
72 ts.iloc[2] = np.nan
73
74 exp = Series([0.0, 1.0, 1.0, 3.0, 4.0], index=ts.index)
75 tm.assert_series_equal(ts.ffill(), exp)
76
77 exp = Series([0.0, 1.0, 3.0, 3.0, 4.0], index=ts.index)
78 tm.assert_series_equal(ts.bfill(), exp)
79
80 exp = Series([0.0, 1.0, 5.0, 3.0, 4.0], index=ts.index)
81 tm.assert_series_equal(ts.fillna(value=5), exp)
82
83 def test_fillna_nonscalar(self):
84 # GH#5703

Callers

nothing calls this directly

Calls 5

SeriesClass · 0.90
date_rangeFunction · 0.90
ffillMethod · 0.45
bfillMethod · 0.45
fillnaMethod · 0.45

Tested by

no test coverage detected