From 1ec2241689a4d4f15deb4808e9d554e8b98ae7bc Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 Aug 2024 20:23:10 +0100 Subject: [PATCH] Fix error in FeatureChoice class --- setup.py | 2 +- src/mdatagen/utils/feature_choice.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index e84e792..5dca904 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='mdatagen', - version='0.1.62', + version='0.1.63', keywords=['machine learning', 'preprocessing data'], packages=find_packages(where="src"), package_dir={"": "src"}, diff --git a/src/mdatagen/utils/feature_choice.py b/src/mdatagen/utils/feature_choice.py index 15cb9f6..e32e46d 100644 --- a/src/mdatagen/utils/feature_choice.py +++ b/src/mdatagen/utils/feature_choice.py @@ -176,7 +176,13 @@ def miss_locations(ordered_id, threshold, N): highest = [] if threshold == 0 else ordered_id[round(-threshold * N) :] if isinstance(ordered_id, pd.Series): - pos_xmiss = np.hstack([lowest.index, highest.index]) + if len(lowest) == 0: + pos_xmiss = np.hstack([lowest, highest.index]) + elif len(highest) == 0: + pos_xmiss = np.hstack([lowest.index, highest]) + else: + pos_xmiss = np.hstack([lowest.index, highest.index]) + elif isinstance(ordered_id, np.ndarray): pos_xmiss = np.hstack([lowest, highest]) else: