In this post, we will see how to resolve Pivot dataframe with uneven categories
Question:

Hello everyone,
I have this dataframe from data I scraped. I wanted to pivot_wider but doing that shifts data down. This might be due to the types column having differents lengths of unique values (eg. price appears 12 times and étage 6 times) but I can’t seem to find a way to do what I want it to do.

In this picture it looks correct but in the column bains/douches the data has shifted down so it’s not correct. If someone could help me out I would really appreciate it. Thanks
Best Answer:
The problem here is that there is no indicator where a new entry begins. Below, I assume that each new “price” row marks the start of a new entry. That way, the missing bathroom appears as such.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com