Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faonet-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faonet-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

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

Hashes for faonet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 35335ee3569e08844c0668d77121f23eefaca908c12e7cccb926fccc19843cfd
MD5 085189eefe31dc45d863ddc6c7b61d2b
BLAKE2b-256 2a2827c2565fa9f1b4af5b048dacc73167ff3c676752fe26aa98e3a7cb41243e

See more details on using hashes here.

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

Hashes for faonet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c8a3604782bd896dd9a7e89b0756f876a9fafaf8b69b8cd003b8bf31738cb0a
MD5 44d58ba08a8bbf82076eb630f299d12f
BLAKE2b-256 ecfcd9b884085b919d8c97f289fdd6acea32a803f73d072d5028ce2eb97e6bef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page