I have been struggling to solve this task.
I have a csv as below, loaded into pandas df. (sorry guys for the formatting, I dunno how to format the Jupyter output