With the given DataFrame, I have solved the problem with about 50 lines of code using a lot of for loops, ifs, elifs, etc. I was wondering if there was a quick pandas code (und