Skip to content

np.float is a deprecated alias for the builtin float #69

Description

@serhii73

Hi,

In [1]: import numpy as np

In [2]: np.__version__
Out[2]: '1.24.0'

In [3]: np.float(3)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 np.float(3)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/numpy/__init__.py:284, in __getattr__(attr)
    281     from .testing import Tester
    282     return Tester
--> 284 raise AttributeError("module {!r} has no attribute "
    285                      "{!r}".format(__name__, attr))

AttributeError: module 'numpy' has no attribute 'float'

When we install the reverse-geocoder, we install the latest version of numpy. And unfortunately, we get an error. A simple solution to this is to change the requirements file pip install "numpy>=1.11.0, <1.24"

In [2]: import numpy as np

In [3]: np.__version__
Out[3]: '1.23.5'

In [4]: np.float(3)
<ipython-input-4-8262e04d58e1>:1: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  np.float(3)
Out[4]: 3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions