Finished (but don't understand)
Pandas solution updated