Hello everyone, I have a dataframe
in Python that seems to be in the wrong format and I want it to be in a different format for my task. For example, I am showing a part of the dataframe
below:
location product sales_Jan_2023 sales_Feb_2023 sales_March_2023
USA Apple 1000 1200 900
USA Samsung 800 1000 1200
Canada Apple 700 500 900
Canada Samsung 1100 900 1200
I don’t want to analyze each month separately, instead, I want to analyze them together, and I want these columns to somehow be converted into rows so that each row corresponds to a sale of the product and in this way, I can analyze all sales simultaneously. If anyone knows how to do this, please provide some methods using example codes.