-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
When running the preprocessing pipeline (specifically in preprocess.py), the following error occurs:
Error processing configuration: Choicelist and default value do not have a common dtype: The DType <class 'numpy.dtypes._PyLongDType'> could not be promoted by <class 'numpy.dtypes.StrDType'>. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype is `object`.
This happens at the line:
choicelist = feature_categories.keys()
df = df.assign(group=np.select(condlist, choicelist))How to Fix
- Explicitly convert
feature_categories.keys()to a list of strings usinglist(). - Explicitly set the
defaultparameter innp.selectto a string value (e.g.,'other'), ensuring all possible outputs are of the same type.
Solution
Change this code:
choicelist = feature_categories.keys()
df = df.assign(group=np.select(condlist, choicelist))to:
choicelist = list(feature_categories.keys())
df = df.assign(group=np.select(condlist, choicelist, default='other'))This ensures that both choicelist and default are of the same type (str), resolving the dtype error.
Metadata
Metadata
Assignees
Labels
No labels