def RSI(price_col, length=14):
    """
    Calculate the Relative Strength Index
    :param price_col: A series of prices
    :param length: Window length
    :return: A series of RSI
    """
    delta = price_col.diff()
    dup, ddown = delta.copy(), delta.copy()
    dup[dup < 0] = 0
    ddown[ddown > 0] = 0
    rolup = dup.rolling(length).mean()
    roldown = ddown.abs().rolling(length).mean()
    rs = rolup / roldown
    return 100.0 - (100.0 / (1.0 + rs))