Skip to content

Commit b6b6023

Browse files
author
y-p
committed
BUG: _flex_binary_moment should validate it's arguments' type
1 parent 87db308 commit b6b6023

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/stats/moments.py

+4
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ def _get_corr(a, b):
197197

198198

199199
def _flex_binary_moment(arg1, arg2, f):
200+
if not (isinstance(arg1,(np.ndarray, DataFrame)) and
201+
isinstance(arg1,(np.ndarray, DataFrame))):
202+
raise ValueError("arguments to moment function must be of type ndarray/DataFrame")
203+
200204
if isinstance(arg1, np.ndarray) and isinstance(arg2, np.ndarray):
201205
X, Y = _prep_binary(arg1, arg2)
202206
return f(X, Y)

0 commit comments

Comments
 (0)