np.bool is not correct
np.bool won't work.
dtype = bool is the correct statement.
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations if you to go that like below the message error, it directs you to the solution that shoul be:
array_a = np.array([[1,2,3],[4,5,6]], dtype = np.bool_)
array_a
Just need to add the underscore after 'bool'.
The same goes for str (string).
Greetings
Yes, underscore or just put it in quotation marks without the np. Theres a lot of ways to do this.
Yes indeed, numpy.[type] is deprecated. You can add the underscore (ex: np.bool_), but you can just use the basic type bool
See https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
numpy.bool bool numpy.bool_
numpy.int int numpy.int_ (default), numpy.int64, or numpy.int32
numpy.float float numpy.float64, numpy.float_, numpy.double (equivalent)
numpy.complex complex numpy.complex128, numpy.complex_, numpy.cdouble (equivalent)
numpy.object object numpy.object_
numpy.str str numpy.str_
numpy.long int numpy.int_ (C long), numpy.longlong (largest integer type)
numpy.unicode str numpy.unicode_
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations