A statistical data access tool for the Freight Analysis Framework (FAF5).
Project description
tidyfaf
tidyfaf is a Python package that provides a "tidy", statistical data access API for the Freight Analysis Framework (FAF5) dataset. Inspired by tidycensus, it allows users to easily retrieve freight flow data and network geometries as pandas DataFrames and GeoDataFrames without dealing with complex file parsing or class instantiation.
Installation
pip install tidyfaf
Usage
1. Statistical Data Access (The "Flat" API)
Retrieve data directly as DataFrames.
import tidyfaf as faf
# Search for metadata codes
zones = faf.search_zone("Washington")
print(zones)
# Get the ID for DC (e.g., 111)
dc_id = 111
# Get Flow Data (DataFrame)
df = faf.get_flows(destination_zone=dc_id, commodity="Pharmaceuticals")
print(df.head())
# Get Network Data (GeoDataFrame)
net = faf.get_network(state="DC")
net.plot()
2. Visualization
Visualization is decoupled from data access. You can retrieve geometries and use the built-in FlowMap or your own tools.
# Get data with geometry
gdf = faf.get_flows(destination_zone=dc_id, geometry=True)
# Create an interactive map
from tidyfaf.visualization import FlowMap
FlowMap(gdf).generate_map("flows.html")
Features
- Data-First Design: Functions return
pandas.DataFrameorgeopandas.GeoDataFrame. - Metadata Helpers: Easily look up FAF Zones, Commodities, Modes, and States.
- Network Support: Retrieve highway network links filtered by state or route.
- Built-in Visualization: Quickly generate interactive Deck.gl maps for flow data.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tidyfaf-0.1.0.tar.gz.
File metadata
- Download URL: tidyfaf-0.1.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d876f21edd9f121a32d31129b91d8aa9517230873a16d4888bec1dbb21f83be
|
|
| MD5 |
ef47bf521b834b7e448adfd8109e7817
|
|
| BLAKE2b-256 |
c2a67978f03ad8a7368968fecc677e728d2a874becbbb2d4a30dc16c270315d6
|
File details
Details for the file tidyfaf-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tidyfaf-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a0422349a811b391f42e4dfeb6343fa5c119a6cc17cd62093d29ab0c062d57c
|
|
| MD5 |
cd9b9fdc48e1e66a697ae80a86d91851
|
|
| BLAKE2b-256 |
767969e07dca6dc828bed2459413af5863d5b7a8af68ef81733cc46e19d38bc1
|