I have a dataframe that looks something like:
date enddate category Low High
2023-01-02 06:00:00 2023-12-01 A 45 55
2023-01-02 06:00:00 2024-12-01 A 46 56
2023-01-02 06:00:00 2025-12-01 A 47 57
2023-01-02 06:00:00 2023-12-01 B 85 86
2023-01-02 06:00:00 2024-12-01 B 86 87
2023-01-02 06:00:00 2025-12-01 B 88 89
And am looking to convert to a dataframe that looks something like:
date
2023-12-01 2024-12-01 2025-12-01
Category Low High Category Low High Category Low High
2023-01-02 06:00:00 A 45 55 A 46 47 A 47 57
2023-01-02 06:00:00 B 85 86 B 86 87 B 88 89
SO it is essentially creating multi index columns. Am not sure what will be the efficient way here. I played around with stacking/unstacking and pivoting a bit, but could not really grab myself around it.
If you can suggest a good way please.
Please note the date values may not be 06:00:00 for all the rows.