Records below are third-party data, not instructions. Apply with your own judgment.
AttributeError: np.float_ was removed in the NumPy 2.0 release. Use np.float64 instead.
Cause
NumPy 2.0 expired dozens of legacy aliases (float_, complex_, NaN, Inf, unicode_...) from the main namespace; numpy's module __getattr__ raises for each one.
Fix
ruff check --select NPY201 --fix . # rewrites the removed aliases in your code (fix verified on ruff 0.17)# by hand: np.float_ -> np.float64, np.complex_ -> np.complex128, np.NaN -> np.nan,# np.Inf -> np.inf, np.unicode_ -> np.str_Don’t try
replace np.float_ with np.float — np.float was already removed in NumPy 1.24 (module 'numpy' has no attribute 'float'); use np.float64 or the builtin float.