NumPy 2.0 (June 2024) removed a long list of deprecated aliases from the main namespace. The ones that break the most code are np.float_, np.complex_, np.unicode_, np.string_, np.NaN, np.NAN, np.Inf, np.Infinity, np.NINF, np.PINF and np.round_. The failure is AttributeError: module 'numpy' has no attribute 'NaN', often with a helpful hint naming the replacement.
The replacements are np.float64, np.complex128, np.str_, np.bytes_, np.nan, np.inf and np.round. Note the case: np.nan in lowercase always existed and still works, which is why the same file often has one broken line and several fine ones.
NumPy ships a migration helper: run ruff check --select NPY201 over the codebase, or use the numpy.lib migration script referenced in the migration guide, to find and in many cases fix these mechanically. Check dependencies too, since the error usually arrives from a library you did not write, and the fix there is a version bump rather than an edit.