Sort Demographics Example

This example shows filtering by state and then sorting by population.

python3 sort_demographics.py
Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 1
State prefix: MA

================================================================================
|          County |  State |   Ed-HS|   H-Own%|  # House | Pop-2020 | Pop. PSQM|
--------------------------------------------------------------------------------
| Barnstable Coun |     MA |   95.5 |     79.8|    94323 |   228996 |       548|
| Berkshire Count |     MA |   91.3 |     69.2|    54813 |   129026 |       141|
|  Bristol County |     MA |   85.7 |     62.6|   217912 |   579200 |       991|
|    Dukes County |     MA |   94.8 |     72.3|     6765 |    20600 |       160|
|    Essex County |     MA |   89.3 |     64.2|   294202 |   809829 |      1508|
| Franklin County |     MA |   93.3 |     68.6|    30569 |    71029 |       102|
|  Hampden County |     MA |   85.8 |     61.1|   179423 |   465825 |       751|
| Hampshire Count |     MA |   94.7 |     66.9|    58838 |   162308 |       299|
| Middlesex Count |     MA |   93.4 |     62.4|   604384 |  1632002 |      1837|
| Nantucket Count |     MA |   95.6 |     70.5|     3713 |    14255 |       226|
|  Norfolk County |     MA |   93.9 |     68.9|   265300 |   725981 |      1693|
| Plymouth County |     MA |   92.9 |     76.5|   187460 |   530819 |       750|
|  Suffolk County |     MA |   86.3 |     36.1|   309844 |   797936 |     12415|
| Worcester Count |     MA |   90.7 |     65.1|   309951 |   862111 |       528|
--------------------------------------------------------------------------------

Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 4

================================================================================
|          County |  State |   Ed-HS|   H-Own%|  # House | Pop-2020 | Pop. PSQM|
--------------------------------------------------------------------------------
| Nantucket Count |     MA |   95.6 |     70.5|     3713 |    14255 |       226|
|    Dukes County |     MA |   94.8 |     72.3|     6765 |    20600 |       160|
| Franklin County |     MA |   93.3 |     68.6|    30569 |    71029 |       102|
| Berkshire Count |     MA |   91.3 |     69.2|    54813 |   129026 |       141|
| Hampshire Count |     MA |   94.7 |     66.9|    58838 |   162308 |       299|
| Barnstable Coun |     MA |   95.5 |     79.8|    94323 |   228996 |       548|
|  Hampden County |     MA |   85.8 |     61.1|   179423 |   465825 |       751|
| Plymouth County |     MA |   92.9 |     76.5|   187460 |   530819 |       750|
|  Bristol County |     MA |   85.7 |     62.6|   217912 |   579200 |       991|
|  Norfolk County |     MA |   93.9 |     68.9|   265300 |   725981 |      1693|
|  Suffolk County |     MA |   86.3 |     36.1|   309844 |   797936 |     12415|
|    Essex County |     MA |   89.3 |     64.2|   294202 |   809829 |      1508|
| Worcester Count |     MA |   90.7 |     65.1|   309951 |   862111 |       528|
| Middlesex Count |     MA |   93.4 |     62.4|   604384 |  1632002 |      1837|
--------------------------------------------------------------------------------

Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 0

Goodbye!