I have data that looks like this. Within each state, I want to send the 6 rows associated with the first zip code as an array and the 6 rows associated with the second zip code as another array to a function. So, I essentially want to make combinations of zip codes within a state and order does not matter.
Is there a pythonic way to do this? I can imagine two loops, the first looping in steps of 6 and the second looping in steps of 6 starting with the zip code after the where the first loop starts.
Thanks for your help!
| STATE | zipcode | agi | count | 
|---|---|---|---|
| AL | 35004 | 1 | 1450 | 
| AL | 35004 | 2 | 1370 | 
| AL | 35004 | 3 | 970 | 
| AL | 35004 | 4 | 650 | 
| AL | 35004 | 5 | 800 | 
| AL | 35004 | 6 | 90 | 
| AL | 35005 | 1 | 1330 | 
| AL | 35005 | 2 | 1010 | 
| AL | 35005 | 3 | 510 | 
| AL | 35005 | 4 | 230 | 
| AL | 35005 | 5 | 200 | 
| AL | 35005 | 6 | 0 | 
| AK | 99501 | 1 | 2580 | 
| AK | 99501 | 2 | 2090 | 
| AK | 99501 | 3 | 1130 | 
| AK | 99501 | 4 | 620 | 
| AK | 99501 | 5 | 910 | 
| AK | 99501 | 6 | 580 | 
| AK | 99502 | 1 | 2930 | 
| AK | 99502 | 2 | 2670 | 
| AK | 99502 | 3 | 1880 | 
| AK | 99502 | 4 | 1330 | 
| AK | 99502 | 5 | 2290 | 
| AK | 99502 | 6 | 880 | 
