Skip to content

Commit f969e30

Browse files
author
y-p
committed
BUG: mom._center_window should validate axis value against data dims
1 parent 09cc554 commit f969e30

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: pandas/stats/moments.py

+3
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ def _rolling_moment(arg, window, func, minp, axis=0, freq=None,
289289

290290

291291
def _center_window(rs, window, axis):
292+
if axis > rs.ndim-1:
293+
raise ValueError("Requested axis is larger then no. of argument dimensions")
294+
292295
offset = int((window - 1) / 2.)
293296
if isinstance(rs, (Series, DataFrame, Panel)):
294297
rs = rs.shift(-offset, axis=axis)

0 commit comments

Comments
 (0)