I am trying to sort my dataframe alphabetically by state (it is technically out of order as of now), and then try sorting the IncomeID column by 1-6 for every six rows. It should follow the pattern 1,2,3,4,5,6,1,2,3,4,5,6 and so on for the entire dataset. Take note of rows 7-12, whose order is incorrect. I know how to sort the states alphabetically, but I am unsure of the second part, or if it is even a possibility. I have included a picture of the relevant columns.
Any help is greatly appreciated.