From d6e4dccc3d78ba0d7d6cb5bbdda4b2feefeeee0d Mon Sep 17 00:00:00 2001 From: schneiderlin <1343152653@qq.com> Date: Sat, 31 Aug 2024 20:24:18 +0800 Subject: [PATCH] update code --- deps.edn | 2 +- src/tablecloth/column/api/column.clj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deps.edn b/deps.edn index 9b5c782..77dd4e5 100644 --- a/deps.edn +++ b/deps.edn @@ -1,6 +1,6 @@ {:extra-paths ["data"] :deps {org.clojure/clojure {:mvn/version "1.11.1"} - techascent/tech.ml.dataset {:mvn/version "7.029"}} + techascent/tech.ml.dataset {:mvn/version "7.030"}} :aliases {:dev {:extra-deps {org.scicloj/clay {:mvn/version "2-beta11"} org.scicloj/note-to-test {:mvn/version "1-alpha7"}}} :test {:extra-deps {org.scicloj/clay {:mvn/version "2-beta11"} diff --git a/src/tablecloth/column/api/column.clj b/src/tablecloth/column/api/column.clj index 15d3c5d..6dd83b9 100644 --- a/src/tablecloth/column/api/column.clj +++ b/src/tablecloth/column/api/column.clj @@ -88,10 +88,10 @@ (fn? order-or-comparator))) (throw (IllegalArgumentException. "`order-or-comparator` must be `:asc`, `:desc`, or a function."))) - (let [order-fn-lookup {:asc fun/<, :desc fun/>} - comparator-fn (if (fn? order-or-comparator) - order-or-comparator - (order-fn-lookup order-or-comparator)) + (let [comparator-fn (cond + (fn? order-or-comparator) order-or-comparator + (= :asc order-or-comparator) compare + (= :desc order-or-comparator) #(compare %2 %1)) sorted-indices (argsort comparator-fn col)] (col/select col sorted-indices))))