I have tried the following code and it works however it shows excess columns that I don’t require. This is the output showing the extra columns: I have tried to add the following code in after sorting the vacancy values however it gives me an error: Answer City1 and City2 are in index since you applied a groupby on it.