def case_ratio(msg):
    """Accepts a twitter message (or used with .apply(lambda x:)).
    Returns the ratio of capitalized characters out of the total number of characters.

    EX:
    df['case_ratio'] = df['text'].apply(lambda x: case_ratio(x))"""
    import numpy as np
    msg_length = len(msg)
    test_upper = [(1) for x in msg if x.isupper()]
    test_lower = [(1) for x in msg if x.islower()]
    test_ratio = np.round(sum(test_upper) / msg_length, 5)
    return test_ratio
