← Back to home

netviz_tools

A published Python package that turns raw trade-flow tables into interactive network visualizations — built on NetworkX, with first-class support for FAOSTAT agricultural trade data.

At a Glance

What it is / problem it solves

NetworkX is the standard for building and analyzing graphs in Python, but it stops short of the steps that actually take the most time in practice: getting messy real-world data into a graph, and getting an analyzable graph back out as something a person can look at. The usual workflow is a pile of one-off scripts — read a CSV, coerce column names, dedupe edges, build the graph, then hand-roll a Matplotlib or Plotly figure every single time.

netviz_tools packages that whole path into four classes so the boilerplate disappears:

The audience is researchers, students, and data analysts who work with relational or trade-flow data and want the clean-build-visualize pipeline handled for them. The FAOSTAT angle makes it immediately useful for anyone studying international agricultural trade.

Key capabilities

Usage

Install from PyPI and go from a commodity name to an analyzable trade network in a few lines:

# pip install netviz_tools

import networkx as nx
from netviz_tools import FAOSTATManager

faostat = FAOSTATManager()

# Browse what's available, then load wheat trade data
faostat.list_commodities(search="wheat", limit=10)
faostat.load_commodity("wheat")

# Major wheat trade flows in 2020 (volume threshold to drop noise)
flows = faostat.get_trade_flows(commodity="wheat", year=2020, min_volume=10000)

# Build a trade network and analyze it with plain NetworkX
network = faostat.create_trade_network(commodity="wheat", year=2020, min_volume=100000)
print(f"{network.number_of_nodes()} nodes, {network.number_of_edges()} edges")
print(f"Network density: {nx.density(network):.4f}")

The general (non-FAOSTAT) path is just as short — DataManager loads and cleans arbitrary node/edge tables, and NetworkManager produces the interactive Plotly, Sankey, and geographic outputs.

Limitations / Roadmap

Tech Stack

Links

← Back to home