Skip to content

Commit 4d7b0f1

Browse files
committed
Added failing test for pandas-dev#12918
1 parent 2015e84 commit 4d7b0f1

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

pandas/tests/frame/test_missing.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,6 @@ def test_frame_interp_max_gap(self):
570570
result = df.interpolate(method="linear", max_gap=2, limit_area="inside")
571571
assert_frame_equal(result, expected_df)
572572

573-
expected_s = Series(
574-
[nan, 1.0, 1, 2.0, 2.0, 2.0, 5.0, nan, nan, nan, -1.0, nan, nan]
575-
)
576-
expected_df = pd.concat([expected_s, expected_s], axis=1)
577-
result = df.interpolate(method="pad", max_gap=2, limit_area="inside")
578-
assert_frame_equal(result, expected_df)
579-
580573
def test_fillna_skip_certain_blocks(self):
581574
# don't try to fill boolean, int blocks
582575

@@ -813,6 +806,19 @@ def test_interp_nan_idx(self):
813806
with pytest.raises(NotImplementedError):
814807
df.interpolate(method="values")
815808

809+
def test_interp_pad(self):
810+
# Test for GH 12918
811+
df = DataFrame(
812+
{"A": [1, 2, np.nan, 4, 5, np.nan, 7], "C": [1, 2, 3, 5, 8, 13, 21]}
813+
)
814+
df = df.set_index("C")
815+
expected = df.copy()
816+
817+
result = df.interpolate(method="pad")
818+
expected.A.loc[3] = 2
819+
expected.A.loc[13] = 5
820+
assert_frame_equal(result, expected)
821+
816822
@td.skip_if_no_scipy
817823
def test_interp_various(self):
818824
df = DataFrame(

0 commit comments

Comments
 (0)