Analyze bipartite trade networks using FAOSTAT data
Project description
FAONet
FAONet is a Python package for building and analyzing bipartite trade networks using data from FAOSTAT.
It provides tools for:
- Importing and filtering trade data.
- Building weighted bipartite networks.
- Calculating structural metrics: degree, strength, clustering, betweenness.
- Visualizing trade matrices, degree distributions, and centrality.
📦 Installation
Clone the repository and install with pip:
git clone https://github.com/galeanojav/FAONet.git
cd FAONet
pip install .
🚀 Quick Start
from faonet.io import load_file
from faonet.filtering import filter_top_percentile
from faonet.network import build_bipartite_network
from faonet.metrics import compute_degree_and_strength
from faonet.plots import plot_weight_matrix
# Load FAOSTAT CSVs
df = load_file("examples/Data/Green_Coffe_FAO_allyears.csv")
# Filter 90% of the market
df_filtered = filter_top_percentile(df, value_column="Value", percentile=0.9)
# Build a bipartite graph
G, reporters, partners = build_bipartite_network(df_filtered, "Reporter Countries", "Partner Countries", "Value")
# Compute degree and strength
df_exporters, df_importers = compute_degree_and_strength(G, reporters, partners)
# Visualize matrix
plot_weight_matrix(df_filtered)
📁 Example
A complete analysis notebook is available in:
📍 examples/FAONet_example.ipynb
It includes:
- Data loading and filtering
- Network construction
- All main metrics (degree, strength, clustering, betweenness)
- Fitted models and visualizations
The example uses FAOSTAT coffee trade data (CSV files in examples/Data/).
🧪 Testing
Run the test suite with:
pytest tests/
📄 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 faonet-0.1.0.tar.gz.
File metadata
- Download URL: faonet-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35335ee3569e08844c0668d77121f23eefaca908c12e7cccb926fccc19843cfd
|
|
| MD5 |
085189eefe31dc45d863ddc6c7b61d2b
|
|
| BLAKE2b-256 |
2a2827c2565fa9f1b4af5b048dacc73167ff3c676752fe26aa98e3a7cb41243e
|
File details
Details for the file faonet-0.1.0-py3-none-any.whl.
File metadata
- Download URL: faonet-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c8a3604782bd896dd9a7e89b0756f876a9fafaf8b69b8cd003b8bf31738cb0a
|
|
| MD5 |
44d58ba08a8bbf82076eb630f299d12f
|
|
| BLAKE2b-256 |
ecfcd9b884085b919d8c97f289fdd6acea32a803f73d072d5028ce2eb97e6bef
|