I have a dataframe that looks like:
Location Account Y2019:MTD:January:Expense Y2019:MTD:January:Income Y2019:MTD:February:Expense
Madrid ABC 4354 56456 235423
Madrid XYX 769867 32556456 6785423
Rome ABC 434654 5214 235423
Rome XYX 632556456 46724423 46588
I would like to reshape this df such that it turns into below
Location Account Year_Month Expense Income
Madrid ABC Jan 2019 4354 56456
Madrid ABC Feb 2019 235423
Madrid XYX Jan 2019 769867 32556456
Madrid XYX Feb 2019 6785423
Rome ABC Jan 2019 434654 5214
Rome ABC Feb 2019 235423
Rome XYX Jan 2019 632556456 46724423
Rome XYX Feb 2019 46588
Can you assist how it would be efficient to pick up the year month string from the column names and also melt it the way we want it