Closed
Description
Link to the notebook
bias-detection-explanability/fairness_and_explainability.ipynb
Describe the bug
When running the script with NumPy 1.20+, an AttributeError
occurs due to the removal of np.object
.
This happens in the number_encode_features()
function when checking column data types:
if result.dtypes[column] == np.object:
Since np.object was deprecated in NumPy 1.20 and completely removed in later versions, this check causes an error.
To reproduce
- Use a Python environment with NumPy 1.20 or later.
- Run the script that calls
number_encode_features()
. - The following error will be raised:
AttributeError: module 'numpy' has no attribute 'object'
Logs
When executing the script, a FutureWarning might appear before the error occurs:
/tmp/ipykernel_596/1535508334.py:8: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
if result.dtypes[column] == np.object:
Then, the script will fail with:
/tmp/ipykernel_596/1535508334.py:8: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
if result.dtypes[column] == np.object:
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself.
Metadata
Metadata
Assignees
Labels
No labels