#NEWLINE# def zscore( time_series , axis = ( - 1 ) ) : #NEWLINE# #INDENT# 'Returns the z-score of each point of the time series\n    along a given axis of the array time_series.\n\n    Parameters\n    ----------\n    time_series : ndarray\n        an array of time series\n    axis : int, optional\n        the axis of time_series along which to compute means and stdevs\n\n    Returns\n    _______\n    zt : ndarray\n        the renormalized time series array\n    ' #NEWLINE# time_series = np . asarray ( time_series ) #NEWLINE# et = time_series . mean ( axis = axis ) #NEWLINE# st = time_series . std ( axis = axis ) #NEWLINE# sl = ( [ slice ( None ) ] * len ( time_series . shape ) ) #NEWLINE# sl [ axis ] = np . newaxis #NEWLINE# zt = ( time_series - et [ sl ] ) #NEWLINE# zt /= st [ sl ] #NEWLINE# return zt