-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
feat!: Removes inplace
option for `pandas.core.resample.Resampler.i…
#58847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7eb4483
479e1f0
9f0a9a0
c124121
9ff7ec9
946492f
181dbfa
855a004
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,7 @@ def test_interpolate_downcast_reference_triggers_copy(): | |
|
||
msg = "Can not interpolate with method=pad" | ||
with pytest.raises(ValueError, match=msg): | ||
df.interpolate(method="pad", inplace=True, downcast="infer") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears that a lot of interpolate usages are still modified in the PR. Only tests that used to call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mroeschke Sorry for the long delay. I was checking this now again and I think we need to clear up the misunderstanding. The wrong behavior is not just related to cases that use from pandas import DataFrame, testing as tm, Timestamp
import numpy as np
df = DataFrame(
{
"A": [1, 2, np.nan, 4],
"B": [1, 4, 9, np.nan],
"C": [Timestamp("2020-08-01 00:00:01"), Timestamp("2020-08-01 00:00:02"), Timestamp("2020-08-01 00:00:03"), Timestamp("2020-08-01 00:00:05")],
"D": list("abcd"),
}
)
result = df.set_index("C").interpolate()
expected = df.set_index("C")
expected.loc[Timestamp("2020-08-01 00:00:03"), "A"] = 2.66667
expected.loc[Timestamp("2020-08-01 00:00:05"), "B"] = 9
tm.assert_frame_equal(result, expected) In pandas 2.* this fails with ---------------------------------------------------------------------------
AssertionError: DataFrame.iloc[:, 0] (column name="A") are different
DataFrame.iloc[:, 0] (column name="A") values are different (25.0 %)
[index]: [2020-08-01T00:00:01.000000000, 2020-08-01T00:00:02.000000000, 2020-08-01T00:00:03.000000000, 2020-08-01T00:00:05.000000000]
[left]: [1.0, 2.0, 3.0, 4.0]
[right]: [1.0, 2.0, 2.66667, 4.0]
At positional index 2, first diff: 3.0 != 2.66667 This is not using resample. Can you please clarify? |
||
df.interpolate(method="pad", inplace=False, downcast="infer") | ||
assert df._mgr._has_no_reference(0) | ||
assert not np.shares_memory(arr_a, get_array(df, "a")) | ||
|
||
|
@@ -285,7 +285,7 @@ def test_fillna_chained_assignment(): | |
tm.assert_frame_equal(df, df_orig) | ||
|
||
|
||
@pytest.mark.parametrize("func", ["interpolate", "ffill", "bfill"]) | ||
@pytest.mark.parametrize("func", ["ffill", "bfill"]) | ||
def test_interpolate_chained_assignment(func): | ||
df = DataFrame({"a": [1, np.nan, 2], "b": 1}) | ||
df_orig = df.copy() | ||
|
Uh oh!
There was an error while loading. Please reload this page.