Skip to content

Type of x, y and z values of a Point are now numpy.float64 #2070

@jordibeen

Description

@jordibeen

With NumPy's 2.0 release, they've changed the representation of their scalars. This has caused the x, y, and z attribute of a Point to no longe be Python's built-in float type, but NumPy's float64 type instead.

>>> from shapely import Point
>>> point = Point(1, 2)
>>> type(point.x)
<class 'numpy.float64'>

However, according to Shapely's documentation of Point, these attributes should be the normal float type instead.


This change caused issues in our project because we were passing a Point's x and y value to our ORM (SQLAlchemy), which was unable to convert a numpy.float64 to a database value.

What is the plan for Shapely going forward? I think it would make sense to have Shapely return Python built-in types, but if you're planning to take the NumPy approach, then the documentation should be updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions