There is a line of code c = np.fromfile(“b.dat”, dtype=np.int, sep=”,”) when running Error,The content is as follows:
DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20 .0-notes.html#deprecations
c = np.fromfile(“b.dat”, dtype=np.int, sep=”,”)
Reason: numpy1.20 has deprecated np.int, checked my version
The numpy version has reached 1.23.2
Solution: Change to np.int16/np.int32 directly to specific bytes or change to np.int_
Run again, problem-solved!
Read More:
- [Solved] RuntimeError: scatter(): Expected dtype int64 for index
- [Solved] RuntimeError: gather(): Expected dtype int64 for index
- [How to Solve] Python TypeError: ‘int‘ object is not subscriptable
- Python Openyxl Error: AttributeError: ‘int‘ object has no attribute ‘upper‘ [How to Solve]
- [Solved] TypeError: unsupported operand type(s) for /: ‘str‘ and ‘int‘
- Python Error: ValueError: invalid literal for int() with base 16: ‘ ‘
- Python PIP TypeError: expected str, bytes or os.PathLike object, not int
- [Solved] Pytroch warning: “Argument interpolation should be of type InterpolationMode instead of int. “
- The Usage of Np.random.uniform()
- Python: Np.where Ternary Operator
- [Solved] Np.argwhere error: maximum recursion depth exceeded while calling
- [How to Fix] TypeError: Cannot cast array data from dtype(‘float64‘) to dtype(‘<U32‘)….
- [Solved] ufunc ‘add‘ did not contain a loop with signature matching types (dtype(‘<U32‘), dtype(‘<U32‘))
- To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe.
- For the problem of rejecting old usage errors after numpy is updated, modified in numpy 1.20; for more details and guidance
- [Solved] Python Using or importing the ABCs from ‘collections‘ instead of from ‘collections.abc‘ is deprecate
- [Solved] RuntimeError (note: full exception trace is shown but execution is paused at: <module>)
- Python error collection: NameError: name ‘numpy’ is not defined
- [Solved] Tensorflow Error: NameError: name ‘layers‘ is not defined
- [Solved] RuntimeError: Numpy is not available (Associated Torch or Tensorflow)