Python Most Efficient Way To Transform This Data Using Pandas

Python Most Efficient Way To Transform This Data Using Pandas