I am trying to create a function to manipulate different datasets for but am facing several issues with this task. I am providing a simplified version of the data I am tryin