Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

np.str deprecated in numpy 1.20 #20

Open
tremou opened this issue Feb 10, 2023 · 0 comments
Open

np.str deprecated in numpy 1.20 #20

tremou opened this issue Feb 10, 2023 · 0 comments

Comments

@tremou
Copy link

tremou commented Feb 10, 2023

Hi,

I get the below error message while trying to read the SysPower table. It works if I use an old numpy version < 1.20 but it complains with newer numpy versions.

Thanks,
Lilia

>>> sdmpy.bintab.unpacker(mysdm['SysPower']).unpack()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/users/etremou/sdm/lib/python3.8/site-packages/sdmpy/bintab.py", line 169, in unpack
    self.row = numpy.recarray(1000, dtype=self.record_dtype)
  File "/users/etremou/sdm/lib/python3.8/site-packages/sdmpy/bintab.py", line 128, in record_dtype
    return [(str(col[0]), self._type_conv(col[2]), col[3]) for col in self.columns]
  File "/users/etremou/sdm/lib/python3.8/site-packages/sdmpy/bintab.py", line 128, in <listcomp>
    return [(str(col[0]), self._type_conv(col[2]), col[3]) for col in self.columns]
  File "/users/etremou/sdm/lib/python3.8/site-packages/sdmpy/bintab.py", line 122, in _type_conv
    return (numpy.str, int(dtype[1:]))
  File "/users/etremou/sdm/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'str'.
`np.str` was a deprecated alias for the builtin `str`. To avoid this error in existing code, use `str` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.str_` 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant