Skip to content

Commit e82c1f7

Browse files
author
y-p
committed
CLN: fix Exception type and tweak message GH5399
1 parent a0afa9d commit e82c1f7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/stats/moments.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ def _get_corr(a, b):
196196
def _flex_binary_moment(arg1, arg2, f):
197197
if not (isinstance(arg1,(np.ndarray, Series, DataFrame)) and
198198
isinstance(arg2,(np.ndarray, Series, DataFrame))):
199-
raise ValueError("arguments to moment function must be of type ndarray/DataFrame")
199+
raise TypeError("arguments to moment function must be of type "
200+
"np.ndarray/Series/DataFrame")
200201

201202
if isinstance(arg1, (np.ndarray,Series)) and isinstance(arg2, (np.ndarray,Series)):
202203
X, Y = _prep_binary(arg1, arg2)

pandas/stats/tests/test_moments.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def test_rolling_corr_pairwise(self):
614614
def test_flex_binary_moment(self):
615615
# GH3155
616616
# don't blow the stack
617-
self.assertRaises(ValueError, mom._flex_binary_moment,5,6,None)
617+
self.assertRaises(TypeError, mom._flex_binary_moment,5,6,None)
618618

619619
def test_corr_sanity(self):
620620
#GH 3155

0 commit comments

Comments
 (0)