I have data for multiple customers in data frame as below-
Customer_id event_type month mins_spent 1 live CM 10 1 live CM1 10 1 catchup CM2 20 1 live CM2 30 2 live CM 45 2 live CM1 30 2 catchup CM2 20 2 live CM2 20
I need the result data frame so that there is one row for each customer and column are combined value of column month and event_type and value will be mins_spent. Result data frame as below-
Customer_id CM_live CM_catchup CM1_live CM1_catchup CM2_live CM2_catchup 1 10 0 10 0 30 20 2 45 0 30 0 20 20
Is there an efficient way to do this instead of iterating the input data frame and creating the new data frame ?