Skip to main content

Analyze bipartite trade networks using FAOSTAT data

Project description

FAONet

Docs PyPI

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 .

or using PyPi version:

pip install faonet

🚀 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.2.0.tar.gz (17.7 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.2.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file faonet-0.2.0.tar.gz.

File metadata

  • Download URL: faonet-0.2.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for faonet-0.2.0.tar.gz
Algorithm Hash digest
SHA256 84b8ebf58876dd8fe970a54e489afd54711dd4d28f23d3bbea9e9840facbf710
MD5 bb659fc3d2f7622019390168e5c5a6b0
BLAKE2b-256 7184676d7254e9f79cf310255a60d2f6babfcb37baf1d9384fa4ce30c7b2346b

See more details on using hashes here.

File details

Details for the file faonet-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: faonet-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for faonet-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 373dfd6aba1986a778a7828463530e8188a5f30eaff613ce8c4e0c9ac4332882
MD5 7a026638de7da9ec4f102546b3b0b115
BLAKE2b-256 a057eb8b7ac95e451b8623e6c8a3215e9b9c71f9f0e840c2501d0f3bba588ca0

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