Skip to content

Commit

Permalink
TST: added rolling_corr test with cener=True GH3155
Browse files Browse the repository at this point in the history
Conflicts:
	pandas/stats/tests/test_moments.py
  • Loading branch information
y-p committed Mar 26, 2013
1 parent b6b6023 commit a626014
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pandas/stats/tests/test_moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,28 @@ def test_flex_binary_moment(self):
# don't blow the stack
self.assertRaises(ValueError, mom._flex_binary_moment,5,6,None)

def test_corr_sanity(self):
#GH 3155
df = DataFrame(
np.array(
[[ 0.87024726, 0.18505595],
[ 0.64355431, 0.3091617 ],
[ 0.92372966, 0.50552513],
[ 0.00203756, 0.04520709],
[ 0.84780328, 0.33394331],
[ 0.78369152, 0.63919667]])
)

res = mom.rolling_corr(df[0],df[1],5,center=True)
self.assertTrue(all([np.abs(np.nan_to_num(x)) <=1 for x in res]))

# and some fuzzing
for i in range(10):
df = DataFrame(np.random.rand(30,2))
res = mom.rolling_corr(df[0],df[1],5,center=True)
print( res)
self.assertTrue(all([np.abs(np.nan_to_num(x)) <=1 for x in res]))

def test_flex_binary_frame(self):
def _check(method):
series = self.frame[1]
Expand Down

0 comments on commit a626014

Please sign in to comment.