
## Overview
To analyze 2025 US exports by state to Canada, Mexico, and the world.

## Execution
- Change data path accordingly
- Run the code in the `trade data.py`.

## Data inputs (Raw data)

# 1. US Census State Exports HS6 (Origin of Movement) [raw data/STHS6M2512.txt]
Link: https://www.census.gov/foreign-trade/data/STHS6M.html
Notes: We downloaded December the 2025 file to get 2025 year-to-date data.
Other links:
  -data layouts: https://www.census.gov/foreign-trade/reference/products/layouts/sths6.html
  -country codes: https://www.census.gov/foreign-trade/schedules/c/countryname.html
  
#2. Population by state [raw data/NST-EST2025-POP.xlsx]

Annual Estimates of the Resident Population for the United States, Regions, States, District of Columbia and Puerto Rico: April 1, 2020 to July 1, 2025 (NST-EST2025-POP.xlsx)
Link: https://www.census.gov/data/tables/time-series/demo/popest/2020s-state-total.html

#3. GDP by state, state names, and BEA region categorizations [raw data/gptstate.csv]
Link: https://www.bea.gov/data/gdp/gdp-state

#4. Trade data - Names for HS-4 products
Link: https://dataweb.usitc.gov/



## Methodology
Exports data are aggregated at state-level (Table 2), and further aggregated to region level (Table 1), with the use of the Census data.

Using the same data, we also aggregated export data by product level (HS-4) for Table 3. 

Canada data are under country code 1220, while Mexico data are under 1220.

## Processed data 
Data are processed as stated in the methodology above and saved to the "processed data" folder.

  - "exports_state.xlsx": Exports by state
  - "exports_hs4.xlsx": Exports by product at HS-4 level
  - "detailed_exports_by_state_hs4.xlsx", "aircraft.xlsx", "electronic_integrated_circuits.xlsx": Detailed product- and state-level distribution of exports
  - "Data.xlsx": Aggregation by region, as shwon in Table 1


