Skip to content

Passing generator to NumPy vstack warning #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cybersea opened this issue Dec 7, 2019 · 1 comment
Open

Passing generator to NumPy vstack warning #14

cybersea opened this issue Dec 7, 2019 · 1 comment

Comments

@cybersea
Copy link

cybersea commented Dec 7, 2019

When trying to run the following line in the raster notebook

listings['brightness_rasterio'] = numpy.vstack(brightnesses)

I received this warning:

FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.

Would the solution be to convert the generator to a list?

This is an extremely useful resource. Thanks so much for making it available!

@y-vectorfield
Copy link

I think the best solution of this problem is as follow.

listings['brightness_rasterio'] = numpy.vstack([brightnesses])

or

listings['brightness_rasterio'] = numpy.vstack(list(brightnesses))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants