holoviz / spatialpandas

Pandas extension arrays for spatial/geometric operations
BSD 2-Clause "Simplified" License
308 stars 25 forks source link

Support numpy 1.24 ragged array conversion #107

Closed ianthomas23 closed 1 year ago

ianthomas23 commented 1 year ago

Fixes #106 and #49.

Implicit conversion of a ragged array (sequence of numpy arrays with incompatible shapes) in numpy 1.24 raises a ValueError rather than a warning. This is a solution to the problem inspired by https://github.com/holoviz/geoviews/pull/608 (thanks @Hoxbro). It is slightly more complicated than that GeoViews fix because we cannot test with numpy 1.24 until numba supports it, so here I am converting the warning that occurs for numpy < 1.24 into an error so that it is handled in the same way and in the same code path as the numpy >= 1.24 fix.

This PR also fixes the following warning:

FutureWarning: ``gather_statistics`` is deprecated and will be removed in a future release. Please use ``calculate_divisions`` instead.
ianthomas23 commented 1 year ago

I have manually checked all the CI run outputs and all of the ragged array warnings have been dealt with.

ianthomas23 commented 1 year ago

Merging this. We probably need to do a dev release and check downstream libraries.