#NEWLINE# def test_corr_rank( self ) : #NEWLINE# #INDENT# tm . _skip_if_no_scipy ( ) #NEWLINE# import scipy #NEWLINE# import scipy.stats as stats #NEWLINE# A = tm . makeTimeSeries ( ) #NEWLINE# B = tm . makeTimeSeries ( ) #NEWLINE# A [ ( - 5 ) : ] = A [ : 5 ] #NEWLINE# result = A . corr ( B , method = 'kendall' ) #NEWLINE# expected = stats . kendalltau ( A , B ) [ 0 ] #NEWLINE# self . assertAlmostEqual ( sexp , expected ) #NEWLINE# result = A . corr ( B , method = 'spearman' ) #NEWLINE# expected = stats . spearmanr ( A , B ) [ 0 ] #NEWLINE# self . assertAlmostEqual ( result , expected ) #NEWLINE# if ( scipy . __version__ < LooseVersion ( '0.9' ) ) : #NEWLINE# #INDENT# raise nose . SkipTest ( 'skipping corr rank because of scipy version {0}' . format ( scipy . __version__ ) ) #NEWLINE# #UNINDENT# A = Series ( [ ( - 0.89926396 ) , 0.94209606 , ( - 1.03289164 ) , ( - 0.95445587 ) , 0.7691031 , ( - 0.06430576 ) , ( - 2.09704447 ) , 0.40660407 , ( - 0.89926396 ) , 0.94209606 ] ) #NEWLINE# B = Series ( [ ( - 1.01270225 ) , ( - 0.62210117 ) , ( - 1.56895827 ) , 0.59592943 , ( - 0.01680292 ) , 1.17258718 , ( - 1.06009347 ) , ( - 0.1022206 ) , ( - 0.89076239 ) , 0.89372375 ] ) #NEWLINE# kexp = 0.4319297 #NEWLINE# sexp = 0.5853767 #NEWLINE# self . assertAlmostEqual ( A . corr ( B , method = 'kendall' ) , kexp ) #NEWLINE# self . assertAlmostEqual ( A . corr ( B , method = 'spearman' ) , sexp )