def ema(df, n, m): #exponential moving average
    """
    Wrapper function to estimate EMA.
    :param df: a pandas DataFrame.
    :return: ema_{t}=(m/n)*a_{t}+((n-m)/n)*ema_{t-1}
    """   
    result = df.copy()
    for i in range(1,len(df)):
        result.iloc[i]= (m*df.iloc[i-1] + (n-m)*result[i-1]) / n
    return result