def sharpe(returns, rfr=0, expanding=0):
    """
    returns: periodic return string
    rfr: risk free rate
    expanding: bool
    """
    if expanding:
        excess = excess_returns(returns, rfr)
        return pd.expanding_mean(excess) / pd.expanding_std(returns)
    else:
        return excess_returns(returns, rfr).mean() / returns.std()
def sharpe ( returns , rfr = 0 , expanding = 0 ) : if expanding : excess = excess_returns ( returns , rfr ) return pd . expanding_mean ( excess ) / pd . expanding_std ( returns ) else : return excess_returns ( returns , rfr ) . mean ( ) / returns . std ( )
returns: periodic return string
    rfr: risk free rate
    expanding: bool