-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Passing in a string column label for DataFrame.ewm(times=...) #43265
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
Conversation
mroeschke
commented
Aug 27, 2021
- xref DEPR: dropping nuisance columns in rolling aggregations #42834 (comment)
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
umm we generally accept a column name for other things, why are we deprecating here? |
|
data = np.arange(10.0) | ||
data[::2] = np.nan | ||
df = DataFrame({"A": data, "time_col": date_range("2000", freq="D", periods=10)}) | ||
with tm.assert_produces_warning(FutureWarning, match="Specifying times"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have any tests with times as an array (you do above in test_ewma_with_times_equal_spacing but you are also hitting the nuiscance path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test passes times
as an array
pandas/pandas/tests/window/test_ewm.py
Lines 126 to 136 in a6943ae
def test_ewma_with_times_variable_spacing(tz_aware_fixture): | |
tz = tz_aware_fixture | |
halflife = "23 days" | |
times = DatetimeIndex( | |
["2020-01-01", "2020-01-10T00:04:05", "2020-02-23T05:00:23"] | |
).tz_localize(tz) | |
data = np.arange(3) | |
df = DataFrame(data) | |
result = df.ewm(halflife=halflife, times=times).mean() | |
expected = DataFrame([0.0, 0.5674161888241773, 1.545239952073459]) | |
tm.assert_frame_equal(result, expected) |
thanks @mroeschke |