From e3cc9b96073c4d724ad9e6f5bffa1cc14f8a96d1 Mon Sep 17 00:00:00 2001 From: juanbc Date: Tue, 28 Nov 2023 00:01:32 -0300 Subject: [PATCH] make some type more strics in the code --- skcriteria/core/dominance.py | 4 ++-- skcriteria/extend.py | 6 +++--- skcriteria/utils/rank.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/skcriteria/core/dominance.py b/skcriteria/core/dominance.py index 37e364d..af9b1ef 100644 --- a/skcriteria/core/dominance.py +++ b/skcriteria/core/dominance.py @@ -251,8 +251,8 @@ def compare(self, a0, a1): ] ) - df = df.assign( - Performance=[performance_a0, performance_a1, eq], + df["Performance"] = pd.Series( + [performance_a0, performance_a1, eq], index=df.index ) return df diff --git a/skcriteria/extend.py b/skcriteria/extend.py index a19dfa8..e38f7a3 100644 --- a/skcriteria/extend.py +++ b/skcriteria/extend.py @@ -125,7 +125,7 @@ def mkagg(maybe_func=None, **hparams): The decorated function should receive the parameters 'matrix', 'objectives', 'weights', 'dtypes', 'alternatives', 'criteria', - 'hparams', or **kwargs. + 'hparams', or kwargs. Additionally, it should return an array with rankings for each alternative and an optional dictionary with calculations that you wish @@ -220,10 +220,10 @@ def mktransformer(maybe_func=None, **hparams): The decorated function should receive the parameters 'matrix', 'objectives', 'weights', 'dtypes', 'alternatives', 'criteria', - 'hparams', or **kwargs. + 'hparams', or kwargs. In addition, it must return a dictionary whose keys are some - as the received parameters (including the keys in '**kwargs'). + as the received parameters (including the keys in 'kwargs'). These values replace those of the original array. If you return 'hparams,' the transformer will ignore it. diff --git a/skcriteria/utils/rank.py b/skcriteria/utils/rank.py index 862afa4..69b8c1d 100644 --- a/skcriteria/utils/rank.py +++ b/skcriteria/utils/rank.py @@ -64,7 +64,7 @@ def rank_values(arr, reverse=False): """ if reverse: arr = np.multiply(arr, -1) - return stats.rankdata(arr, "dense").astype(int) + return stats.rankdata(arr, "dense").astype(np.int64) # =============================================================================