def shift_series(s):
 s0 = s.copy()
 s0 = s0.shift(1)
 s0.iloc[0] = 0.0
 return s0

def shift_series ( s ) : s0 = s . copy ( ) s0 = s0 . shift ( 1 ) s0 . iloc [ 0 ] = 0.0 return s0
produces a copy of the provided series shifted by one .