From c87750f57f8e27f9f18aa6b2d9d3eb25ea9ef87c Mon Sep 17 00:00:00 2001 From: Nitzan Pomerantz <9297302+nitzpo@users.noreply.github.com> Date: Sat, 25 Oct 2025 13:57:25 +0300 Subject: [PATCH] Fix median calculation Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- nadlan_mcp/govmap/statistics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nadlan_mcp/govmap/statistics.py b/nadlan_mcp/govmap/statistics.py index 4c29338..d3f7a96 100644 --- a/nadlan_mcp/govmap/statistics.py +++ b/nadlan_mcp/govmap/statistics.py @@ -66,7 +66,7 @@ def calculate_deal_statistics(deals: List[Dict[str, Any]]) -> Dict[str, Any]: sorted_prices = sorted(prices) stats["price_stats"] = { "mean": round(sum(prices) / len(prices), 2), - "median": sorted_prices[len(sorted_prices) // 2], + "median": (sorted_prices[len(sorted_prices) // 2] + sorted_prices[(len(sorted_prices) - 1) // 2]) / 2, "min": min(prices), "max": max(prices), "p25": sorted_prices[len(sorted_prices) // 4],