holoviz / spatialpandas

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

Warning: Creating an ndarray from ragged nested sequences is deprecated #49

Closed brl0 closed 1 year ago

brl0 commented 4 years ago

This warning occurs numerous times during testing.

tests/test_fixedextensionarray.py: 191 warnings tests/test_geodataframe.py: 1 warning tests/geometry/test_to_geopandas.py: 2 warnings /home/travis/miniconda/envs/test-environment/lib/python3.7/site-packages/numpy/core/_asarray.py:83: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray return array(a, dtype, copy=False, order=order)

This occurs with the latest version of spatialpandas, and numpy 1.19.1.

jbednar commented 4 years ago

Hmm. Creating arrays with dtype=object isn't normally advisable, so I can see why it would be warning. It's fine for code used only in testing, but if the actual issue is in the main codebase, it does sound like something that needs fixing.

jlstevens commented 3 years ago

I'm tagging this as a bug as having lots of warnings appear is very annoying (even if everything else is working).

ianthomas23 commented 2 years ago

Most these warnings have been fixed as part of #92. One remains: https://github.com/holoviz/spatialpandas/blob/518b4f1a98dc3dc2577dac31ebceb111ab017318/spatialpandas/geometry/basefixed.py#L111

We cannot force a dtype=object here, so it needs further consideration.

ianthomas23 commented 1 year ago

Closed by #107.