I have a data frame like below:
TAG TAG_NAME METRIC METRIC_NAME CAPTURE_DATE MB
DB PRO SPACE A 2024-03-01 3
DB PRO SPACE B 2024-03-01 4
DB PRO SPACE C 2024-03-01 5
DB PRO SPACE D 2024-03-01 6
DB PRO SPACE E 2024-03-01 7
DB PRO SPACE A 2024-03-01 8
DB PRO SPACE B 2024-03-01 9
DB PRO SPACE C 2024-03-01 10
DB PRO SPACE D 2024-03-01 11
DB PRO SPACE E 2024-03-01 12
I want to split column MB based on the unique combination of columns (TAG, TAG_NAME, METRICS, CAPTURE_DATE).
And the output should look like below:
TAG TAG_NAME METRIC METRIC_NAME CAPTURE_DATE MB_Firt MB_Second
DB PRO SPACE A 2024-03-01 3 8
DB PRO SPACE B 2024-03-01 4 9
DB PRO SPACE C 2024-03-01 5 10
DB PRO SPACE D 2024-03-01 6 11
DB PRO SPACE E 2024-03-01 7 12
I am new to pandas/Python. Your help will be highly appreciated.
I tried with pivot and melt, no help
Shanzid Hossain is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.