def sma(arg, n):
    """ If n is 0 then return the ltd mean; else return the n day mean """
    if n == 0:
        return pd.expanding_mean(arg)
    else:
        return pd.rolling_mean(arg, n, min_periods=n)
def sma ( arg , n ) : if n == 0 : return pd . expanding_mean ( arg ) else : return pd . rolling_mean ( arg , n , min_periods = n )
If n is 0 then return the ltd mean; else return the n day mean