I have a dataframe, column 1 contains the name of the states. Column 2 contains the city. Column 3, 4, 5...contains data I'm interested in for each city. Right now, the order of rows is random. I'd like to group the rows so that cities that are in the same states are grouped together.
For example, After the ordering, data will look like this:
Pennsylvania, Bryn Mawr, 33, 283, 392
Pennsylvania, Philadelphia, 37, 373, 328
Pennsylvania, Pittsburgh, 37, 483, 479
Ohio, Columbus, 382, 830, 281
Ohio, Hudson, 291, 39, 10
Before ordering the rows are in random order. Any idea would be appreciated!