pytzwhere icon indicating copy to clipboard operation
pytzwhere copied to clipboard

Minor change to avoid numpy DeprecationWarning

Open oscgonfer opened this issue 4 years ago • 5 comments

This is a minor PR to avoid numpy DeprecationWarning on:

numpy/core/_asarray.py:102: 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)

oscgonfer avatar Jan 04 '22 15:01 oscgonfer

Bump on merging this?

VivaLaPanda avatar Oct 09 '22 18:10 VivaLaPanda

Hi!

Note that with latest numpy 1.24.0rc0 this deprecation notice becomes an exception:

  File "/home/remi/code/idunn/idunn/utils/__init__.py", line 4, in <module>
    tz = tzwhere.tzwhere(forceTZ=True)
  File "/home/remi/.local/share/virtualenvs/idunn-JfTPVegI/lib/python3.10/site-packages/tzwhere/tzwhere.py", line 62, in __init__
    self.timezoneNamesToPolygons[tzname] = WRAP(polys)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (1, 2) + inhomogeneous part.

remi-dupre avatar Nov 29 '22 12:11 remi-dupre

As the repository is clearly not being maintained, maybe we should make a port and release it on pypi. This should also guarantee that long term support is there, but in my case I don't have time to get fully involved in checking possible future issues for dependencies.

Opinions?

oscgonfer avatar Dec 21 '22 12:12 oscgonfer

I don't want to hijack this PR, but I want to point out that my package timezonefinder offers the same functionality and is being actively maintained. If you are missing functionality, feel free to open an issue/PR there. Hope this helps.

jannikmi avatar Dec 21 '22 12:12 jannikmi

@jannikmi, thank you for the comment. I personally hadn't heard of your timezonefinder package, but I have just tested it, and in my particular case, it works as I need it. It wouldn't make sense to keep working with pytzwhere unless someone else has another issue with yours, but eitherway development shouldn't be divided into two different repos that can potentially do the same thing.

Long story short, switching to timezonefinder seems like the best solution.

oscgonfer avatar Dec 21 '22 13:12 oscgonfer