From 6ed1aacee5197b08890f133c88d9480f816d0342 Mon Sep 17 00:00:00 2001 From: Dan Snow Date: Wed, 8 May 2024 15:04:03 +0000 Subject: [PATCH] Switch MKI sorting from quicksort to mergesort --- assesspy/formulas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assesspy/formulas.py b/assesspy/formulas.py index 8594c92..f3306f0 100644 --- a/assesspy/formulas.py +++ b/assesspy/formulas.py @@ -176,7 +176,7 @@ def prb(assessed, sale_price, round=None): # Calculate the Gini cofficients needed for KI and MKI def calculate_gini(assessed, sale_price): df = pd.DataFrame({"av": assessed, "sp": sale_price}) - df = df.sort_values(by="sp") + df = df.sort_values(by="sp", kind="mergesort") # for stable sort results assessed_price = df["av"].values sale_price = df["sp"].values n = len(assessed_price)