In [9]:
import math
In [10]:
def calculate_angle(u, v):
    dot_product = np.dot(u, v)

    u_mag = np.linalg.norm(u)
    v_mag = np.linalg.norm(v)
    magnitude = u_mag * v_mag
    
    # math.acos is just the inverse of cos
    return math.degrees(math.acos(dot_product / magnitude))
In [11]:
print(calculate_angle([1, 0], [1, 1]))
45.00000000000001