src/environment/portfolio.py
def random_shift(x, fraction):
    """ Apply a random shift to a pandas series. """
    min_x, max_x = np.min(x), np.max(x)
    m = np.random.uniform(-fraction, fraction, size=x.shape) + 1
    return np.clip(x * m, min_x, max_x)
 Apply a random shift to a pandas series. 
Apply a random shift to a pandas series.
Apply a random shift to a pandas series .
def random_shift(x, fraction):
    min_x, max_x = np.min(x), np.max(x)
    m = np.random.uniform(-fraction, fraction, size=x.shape) + 1
    return np.clip(x * m, min_x, max_x)
def random_shift ( x , fraction ) : min_x , max_x = np . min ( x ) , np . max ( x ) m = np . random . uniform ( - fraction , fraction , size = x . shape ) + 1 return np . clip ( x * m , min_x , max_x )
Apply a random shift to a pandas series.
Apply a random shift to a pandas series .
""" Apply a random shift to a pandas series. """
x
fraction