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

Function test_reindex_pad2

pandas/tests/series/methods/test_reindex.py:129–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127
128
129def test_reindex_pad2():
130 # GH4604
131 s = Series([1, 2, 3, 4, 5], index=["a", "b", "c", "d", "e"])
132 new_index = ["a", "g", "c", "f"]
133 expected = Series([1, 1, 3, 3.0], index=new_index)
134
135 # this changes dtype because the ffill happens after
136 result = s.reindex(new_index).ffill()
137 tm.assert_series_equal(result, expected)
138
139 result = s.reindex(new_index).ffill()
140 tm.assert_series_equal(result, expected)
141
142 expected = Series([1, 5, 3, 5], index=new_index)
143 result = s.reindex(new_index, method="ffill")
144 tm.assert_series_equal(result, expected)
145
146
147def test_reindex_inference():

Callers

nothing calls this directly

Calls 3

reindexMethod · 0.95
SeriesClass · 0.90
ffillMethod · 0.45

Tested by

no test coverage detected