How to get the angle between two vectors in Python
| Created | |
|---|---|
| Tags | |
| URL | https://www.kite.com/python/answers/how-to-get-the-angle-between-two-vectors-in-python |

Getting the angle between two vectors returns the angle in radians between two vectors of equal dimension.
Use numpy.arccos() to get the angle between two vectors
Use lists to represent vectors. Use vector / np.linalg.norm(vector) to get the unit vector of vector. Do this for both vectors. Call np.dot(v1, v2) to get the dot product of the previous results v1 and v2. Call np.arccos(x) with the previous result as x to get the angle between the two original vectors.