spatialpandas icon indicating copy to clipboard operation
spatialpandas copied to clipboard

Warning: Creating an ndarray from ragged nested sequences is deprecated

Open brl0 opened this issue 4 years ago • 3 comments

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.

brl0 avatar Aug 01 '20 21:08 brl0

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.

jbednar avatar Aug 07 '20 02:08 jbednar

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

jlstevens avatar Dec 07 '20 16:12 jlstevens

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 avatar Jul 27 '22 12:07 ianthomas23

Closed by #107.

ianthomas23 avatar Jan 09 '23 09:01 ianthomas23