From 97eb6506c7f519b31b0c9062bc79873cef89ebea Mon Sep 17 00:00:00 2001 From: craisin Date: Sun, 15 Feb 2026 10:31:51 -0800 Subject: [PATCH] readme --- README.md | 18 ++++++++++++++++++ citydist.py | 5 +---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d708846 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Minimum Distance to Major City (in Africa) + +## Usage + +### Install Dependencies +```bash +pip install -r requirements.txt +``` + +### Usage +```python +from citydist import closest_city +point = 30.0444, 31.2357 +print(closest_city(point, population_threshold=10000)) #default threshold is 0, returns a dict +``` + +## About the Data +`africapolis.csv` is pulled from [Africapolis](https://africapolis.org). Population data is from the Population_2020 column. \ No newline at end of file diff --git a/citydist.py b/citydist.py index 94f53e7..786ccb8 100644 --- a/citydist.py +++ b/citydist.py @@ -17,7 +17,4 @@ def closest_city(point, df=None, population_threshold=0): "population": np.int64(city["Population"]), "distance": np.float64(distances[min_index].km), "location": (city["Latitude"], city["Longitude"]) - } - -df = pd.read_csv("africapolis.csv", index_col=0) -print(closest_city((0,0), df=df, population_threshold=50000)) \ No newline at end of file + } \ No newline at end of file