Affected File
causallib/preprocessing/filters.py:255
Current Code
is_removed = np.zeros(X.shape[1], dtype=np.bool)
Root Cause
np.bool was deprecated in NumPy 1.20 and fully removed in NumPy 1.24 (2022-12). In NumPy >= 1.24, using np.bool raises:
AttributeError: module 'numpy' has no attribute 'bool'
np.bool was an alias for Python's built-in bool.
Impact
- Severity: High — hard crash at runtime on NumPy >= 1.24
- Affects the correlation-based feature filtering in
preprocessing/filters.py
Solution
# Before:
is_removed = np.zeros(X.shape[1], dtype=np.bool)
# After:
is_removed = np.zeros(X.shape[1], dtype=bool)
Python's built-in bool is the canonical replacement. np.bool_ can also be used if NumPy scalar type is explicitly required.
References
Affected File
causallib/preprocessing/filters.py:255Current Code
Root Cause
np.boolwas deprecated in NumPy 1.20 and fully removed in NumPy 1.24 (2022-12). In NumPy >= 1.24, usingnp.boolraises:np.boolwas an alias for Python's built-inbool.Impact
preprocessing/filters.pySolution
Python's built-in
boolis the canonical replacement.np.bool_can also be used if NumPy scalar type is explicitly required.References