Package: unitedstates
U.S StatesU.S States is a python package that provides information about states. This package is currently being built, so there is information that will be missing at the moment.DocumentsInstallThe package can be downloaded from PyPi by using pip3 in the following way:pip3 install unitedstatesStatesBefore we get started, we need to define if we will grant DC statehood.# If DC will be counted as a statefromstatesimportStates_Abbreviatedstates_abbreviated=States_Abbreviated(DC_Statehood=True)# If DC will not be counted as a statefromstatesimportStates_Full_Namestates_full_name=States_Full_Name(DC_Statehood=False)States are divided by regions and divisions in accordance with the U.S Census. The following are the divisions, which are class attributes.east_north_centraleast_south_centralmid_atlanticmountainnew_englandpacificsouth_atlanticwest_north_centralwest_south_centralmountain_states=states_full_name.mountainThe following are regions, which are class attributes.northeast_regionmidwest_regionsouth_regionIn order to retrieve all the states, the all_states attribute can be used.These attributes can be found on both the States_Full_Name() and States_Abbreviated() class.This package contains information about each state, here is a list of the info included:official_namefull_nameabbreviatedcapitalpopulationarea_sq_kmtime_zoneregionIn order to retrieve this info, the get_states_info() method can be use.fromstatesimportStatesstates=States()virginia_info=states.get_state_info('Virginia')Which would return the following.{   "official_name":"Commonwealth of Virginia",
    "full_name":"Virginia",
    "abbreviated":"VA",
    "capital":"Richmond",
    "population": 8535519,
    "area_sq_km":110786,
    "time_zone": ["Eastern Standard Time","GMT-5"],
    "region":"South Atlantic"}Keep in mindSome states contain more than one time zone depending which town you are located. At the moment, the info only contains the major one.You can pull all the available states by passing the function "all".TerritoriesYou can access the territory classes by importing them from states.
Territories have the following classes:Territories_AbbreviatedTerritories_Full_NameAssociated_StatesUninhabitated_TerritoriesfromstatesimportTerritories_AbbreviatedBoth the Territories_Abbreviated and Territories_Full_Name contain the following attributes:atlanticpacificall_territoriesatlantic_territories=Territories_Abbreviated().atlanticAssociated_States contains the following attributes:pacific_abbreviatedpacific_full_nameUninhabitated_Territories contains the following attributes:all_territoriesThis package contains information about each state, here is a list of the info included:official_namefull_nameabbreviatedcapitalpopulationarea_sq_kmtime_zoneregionIn order to retrieve this info, the get_territory_info() method can be use.fromstatesimportTerritoriesterritories=Territories()virginia_info=territories.get_territory_info('Puerto Rico')Which would return the following.{   "official_name":"Commonwealth of Puerto Rico",
    "full_name":"Puerto Rico",
    "abbreviated":"PR",
    "capital":"San Juan",
    "population": 3193694,
    "area_sq_km":9104,
    "time_zone": ["Atlantic Standard Time","GMT-4"],
    "region":"Atlantic"}You can pull all the available territories by passing the function "all".ContributionWe welcome everyone that wants to contribute. Please see the contribution page for guidelines on contributing and submitting feature requests.Join us in social media!Discord -Full StackResources usedhttps://www2.census.gov/geo/pdfs/maps-data/maps/reference/us_regdiv.pdfhttps://www.corporateservices.noaa.gov/finance/docs/AOD/LIST_OF_US_TERRITORIES.pdfhttps://www.cdc.gov/publichealthgateway/oia/territories-states.htmlhttps://www.txdmv.gov/sites/default/files/body-files/State_and_Country_Codes.pdfhttps://www.cia.gov/the-world-factbook/https://www.census.gov/schools/facts/