Skip to content

Commit

Permalink
BUG: _flex_binary_moment should validate it's arguments' type
Browse files Browse the repository at this point in the history
  • Loading branch information
y-p committed Mar 26, 2013
1 parent 87db308 commit b6b6023
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pandas/stats/moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def _get_corr(a, b):


def _flex_binary_moment(arg1, arg2, f):
if not (isinstance(arg1,(np.ndarray, DataFrame)) and
isinstance(arg1,(np.ndarray, DataFrame))):
raise ValueError("arguments to moment function must be of type ndarray/DataFrame")

if isinstance(arg1, np.ndarray) and isinstance(arg2, np.ndarray):
X, Y = _prep_binary(arg1, arg2)
return f(X, Y)
Expand Down

0 comments on commit b6b6023

Please sign in to comment.