Skip to content

ENH: Raise ValueError for unsupported Window functions #27275

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

Merged
merged 18 commits into from
Jul 11, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test unknown function
  • Loading branch information
ihsansecer committed Jul 10, 2019
commit 69ae66d3963e8ba42c32ded3777e30c3ec49b92f
14 changes: 14 additions & 0 deletions pandas/tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,20 @@ def test_numpy_compat(self, method):
with pytest.raises(UnsupportedFunctionCall, match=msg):
getattr(e, method)(dtype=np.float64)

def test_agg_unknown(self):
df = pd.DataFrame({"A": np.arange(5)})
roll = df.rolling(2)

msg = "'foo' is an unknown string function"
with pytest.raises(AttributeError, match=msg):
roll.agg("foo")

with pytest.raises(AttributeError, match=msg):
roll.agg(["foo"])

with pytest.raises(AttributeError, match=msg):
roll.agg({"A": "foo"})


# gh-12373 : rolling functions error on float32 data
# make sure rolling functions works for different dtypes
Expand Down