def runstest_1samp(x, cutoff='mean', correction=True):
 if (cutoff == 'mean'):
  cutoff = np.mean(x)
 elif (cutoff == 'median'):
  cutoff = np.median(x)
 xindicator = (x >= cutoff).astype(int)
 return Runs(xindicator).runs_test(correction=correction)

def runstest_1samp ( x , cutoff = 'mean' , correction = True ) : if ( cutoff == 'mean' ) : cutoff = np . mean ( x ) elif ( cutoff == 'median' ) : cutoff = np . median ( x ) xindicator = ( x >= cutoff ) . astype ( int ) return Runs ( xindicator ) . runs_test ( correction = correction )
use runs test on binary discretized data above/below cutoff parameters x : array_like data .