# Global Import-Export Route HS4 Flows (1995-2024)

Annual export values between country pairs by HS4 product group, with a count of active HS6 products within each group.

## What one row represents
one year, exporter-importer route, and HS4 product group

## Included measures and context
- Annual export value in US dollars
- Exporter and importer country codes
- Active HS6 product count

## Metric notes
- HS4 is a four-digit Harmonized System product group.
- Fields marked USD are monetary values denominated in US dollars.
- Count fields report the number of items named in the field, such as products, partners, or routes.
- Country fields ending in ISO3 use three-letter ISO 3166-1 country codes.

## Fields
Column names are shown exactly as they appear in the CSV file. The schema lists the same fields, and the sample file shows example values.

- `year` — `uint16`
- `exporter_iso3` — `string`
- `importer_iso3` — `string`
- `hs4` — `string`
- `export_value_usd` — `float64`
- `active_hs6_count` — `uint64`

## Coverage and size
- Coverage: 1995-2024 annual observations where available
- Records: 123,487,670
- CSV file size: 5.5 GB
- Release: 1.0.0
- SHA-256: `2e9088faf8cba4c2e6fbdb799abf13b0cb5515f9e7d5c063a99b6dd4a56a103c`

## Files
- `data.csv` — complete dataset
- `manifest.json` — dataset description, coverage, record count, and download details
- `schema.json` — field names, row definition, included measures, and metric notes
- `sample.json` — example records
- `README.md` — these notes

## Read the CSV file with Python
```python
import pyarrow as pa
import pyarrow.csv as csv

column_types = {
    "year": pa.type_for_alias("uint16"),
    "exporter_iso3": pa.type_for_alias("string"),
    "importer_iso3": pa.type_for_alias("string"),
    "hs4": pa.type_for_alias("string"),
    "export_value_usd": pa.type_for_alias("double"),
    "active_hs6_count": pa.type_for_alias("uint64"),
}
reader = csv.open_csv(
    "data.csv",
    read_options=csv.ReadOptions(use_threads=False),
    parse_options=csv.ParseOptions(newlines_in_values=True, ignore_empty_lines=False),
    convert_options=csv.ConvertOptions(
        column_types=column_types, null_values=[""],
        strings_can_be_null=True, quoted_strings_can_be_null=False,
    ),
)
for batch in reader:
    print(batch.num_rows)  # Process one batch at a time.
```

Install `pyarrow` if it is not already available: `python -m pip install pyarrow`.

## Sources and related files
- OECD BIMTS HS2017-6D
- CEPII where included
- Dataset page: https://www.yugalinks.org/datasets/v1/import-export/import-export-route-hs4-year-flows-v1/
- Original dataset record: https://huggingface.co/datasets/yugalinks/import-export-route-hs4-year-flows-v1

---

Published by Yugalinks: https://www.yugalinks.org/datasets/v1/import-export/import-export-route-hs4-year-flows-v1

Contact: [support@yugalinks.com](mailto:support@yugalinks.com)


## CSV values

The CSV uses UTF-8 and includes the field names in the first row. Country and product codes are text; keep their leading zeros.
An unquoted empty field means unavailable. A quoted empty field is an empty string. Literal text such as NA and null remains text.
Keep the column types shown above when reading numbers, so large counts and decimal values are not rounded.
