Malawi Information Library (Districts, Currency, Agriculture, Health, Demographics)
Project description
mw_info
A lightweight Python library to access structured information about Malawi’s districts, agriculture, currency exchange rates, health facilities, and demographics.
Features
✅ District-level insights:
Region, coordinates, population, climate, timezone, elevation, and more
✅ Currency conversion:
Convert between MWK and major currencies (USD, EUR, ZAR, etc.)
✅ Agricultural info:
Query crops and fish species using Chichewa, English, or scientific name
✅ Health data:
Get health facility counts (hospitals, clinics, health posts) by district
✅ Demographics:
Population totals, gender ratios, age distribution, and urban/rural splits
Installation
pip install mw-info
or for development:
git clone https://github.com/Tuntufye4/mw_info.git
cd mw_info
pip install -e .
Usage
DistrictInfo Class, Methods & Examples
get_all_districts()
districts = DistrictInfo()
all_districts = districts.get_all_districts()
print(all_districts)
# Output: ['Lilongwe', 'Blantyre', 'Machinga', ...]
get_district_info(district_name, fields=None)
districts = DistrictInfo()
#### Full info for Lilongwe
info = districts.get_district_info("Lilongwe")
print(info)
#### Selected fields only
selected = districts.get_district_info("Mangochi", fields=["population_2023", "languages", "climate"])
print(selected)
filter_by_region(region_name)
Returns list of district dictionaries for districts in a given region.
districts = DistrictInfo()
southern_districts = districts.filter_by_region("Southern")
for d in southern_districts:
print(d["district"])
### Outputs districts in Southern region
get_all_district_data()
Returns the full raw list of all district dictionaries.
districts = DistrictInfo()
all_data = districts.get_all_district_data()
print(all_data[0]) # Print first district data
CurrencyConverter Class, Methods & Examples
available_currencies()
Returns list of supported currency codes.
print(currency.available_currencies())
Example output: ['USD', 'EUR', 'ZAR', 'GBP', 'KES', ...]
convert_from_base(amount, to_currency)
Convert amount from MWK (base currency) to another currency.
mwk_amount = 10000
usd_amount = currency.convert_from_base(mwk_amount, "USD")
print(f"{mwk_amount} MWK is approximately {usd_amount} USD")
convert_to_base(amount, from_currency)
Convert amount from another currency to MWK.
usd_amount = 100
mwk_amount = currency.convert_to_base(usd_amount, "USD")
print(f"{usd_amount} USD is approximately {mwk_amount} MWK")
AgriInfoMw Class Methods
from agriculture_info import AgricultureInfoMW
agri = AgricultureInfoMW()
Query crop or fish info by any name (Chichewa, English, or Scientific)
crop = agri.query_info("Chimanga")
print(crop)
fish = agri.query_info("Oreochromis shiranus")
print(fish)
Query by English name
crop2 = agri.query_info("Maize")
print(crop2)
List all crops
all_crops = agri.list_all_crops()
print(all_crops)
List all fish species
all_fish = agri.list_all_fish()
print(all_fish)
Class HealthInfo
from mw_info.health import HealthInfoMW
health = HealthInfoMW()
List all districts
print(health.get_all_districts())
Get district
print(health.get_district_health("Zomba"))
Filter by facility count
print(health.filter_by_facility_count("hospitals", threshold=3))
Class DemographicsInfoMW
from mw_info.demographics import DemographicsInfoMW
demo = DemographicsInfoMW()
Get all districts
print(demo.get_all_districts())
Get Total Population
print(demo.get_population_total("Lilongwe")) print(demo.get_urban_rural_split("Blantyre"))
Get district data
print(demo.get_district_data("Zomba", fields=["population", "urban_percent"]))
Data Source
All the yml files datastores are chatgpt generated.
License
This project is licensed under the MIT License
Maintainer
Tuntufye Mwanyongo
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 mw_info-0.1.1.tar.gz.
File metadata
- Download URL: mw_info-0.1.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e31f0b7306beaabb3db3531247e4e47e1cf8c8ac5f509aaeeae8e3b14e6943a1
|
|
| MD5 |
ba237b94cb14b407c639ad5dcebc9cf5
|
|
| BLAKE2b-256 |
7f4072411c648eee806fe7c6e1c372569ef7256fa1bcb6387014b8ef24071b74
|
File details
Details for the file mw_info-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mw_info-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bbcec5ee886c6256b13db51077544c2f89151a5d59fea4dc9cd3d012eef590a
|
|
| MD5 |
5d64a78c0397e7bc6481fbf2527b8e84
|
|
| BLAKE2b-256 |
dc67db68e2575a2d9a7248bf9c8c46de2ecd16c6523823015cf4fd01cbd8cf02
|