I\'m having some issue with what I think should have been a pretty straightforward data transformation task. I have a dataframe that looks something like this: