Input a degree (90X) and the matrix will rotate accordingly.
This is an exercise on "Automate the Boring Stuff Wotj Python". The instruction is to use raw python and build nested loop. However, I found using numpy to be much more succint.
Pandas can also be used. The idea, at end of day, is to vectorize data as matrix for easier transformation.
The raw python is here for comparison.