Skip to content
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

Warn about deprecation of sindex.intersection objects parameter #1440

Merged
merged 4 commits into from Jun 7, 2020

Conversation

adriangb
Copy link
Contributor

As discussed in #1439, I think it would be best to deprecate the objects parameter. This makes a warning for using it. Hopefully this will be a good first step in that direction.

@martinfleis
Copy link
Member

Can we add tests that it properly raised a warning? Wrapping this line in this would do the job.

with pytest.warns(FutureWarning, match="A future version of GeoPandas will deprecate"):

hits = list(self.df.sindex.intersection((2.5, 2.5, 4, 4), objects=True))

geopandas/sindex.py Outdated Show resolved Hide resolved
@adriangb adriangb changed the title Warn about derpecation of sindex.intersection objects parameter Warn about deprecation of sindex.intersection objects parameter May 22, 2020
@adriangb
Copy link
Contributor Author

@martinfleis are we going to make a dev branch to work on stuff that isn't intended for 0.8.0?

"""
if objects:
warn(
"A future version of GeoPandas will deprecate the `objects`"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

'objects' is deprecated and will be replaced by a different interface to labels in the sindex geometries in an upcoming release.

I don't know that the "If you use this option" is necessary here; this doesn't get added to other deprecation notices.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thoughts were that we do not really know who uses this interface and why. I thought it would be good to get some issue reports that might help shape what that future implementation of loc/label based indexing will look like, or if it is needed at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just say it will be removed in the future. But it might be good to indicate what to do instead (how to achieve the same behaviour without using the keyword), so it's clear for users how to replace their usage of it.

Copy link
Contributor Author

@adriangb adriangb May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So something like:

`objects` is deprecated and will be removed in a future version. Instead, use `iloc` to index your GeoSeries/GeoDataFrame using integer indexes returned by `intersection`.

?

@jorisvandenbossche
Copy link
Member

are we going to make a dev branch to work on stuff that isn't intended for 0.8.0?

We didn't do that yet in the past (the main releases are cut from master, only for bug fix releases, we made separate branches). I would say: if you want to work on something that is only for after 0.8.0, you can already start on it / open a PR targetting master, but it can only be merged after 0.8 is released. If it turns out to be a problem in practice, we can always reconsider our branching strategy.

geopandas/sindex.py Outdated Show resolved Hide resolved
"""
if objects:
warn(
"A future version of GeoPandas will deprecate the `objects`"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just say it will be removed in the future. But it might be good to indicate what to do instead (how to achieve the same behaviour without using the keyword), so it's clear for users how to replace their usage of it.

@adriangb
Copy link
Contributor Author

I pushed the changes to the warning/docs text

@adriangb
Copy link
Contributor Author

adriangb commented Jun 6, 2020

Pinging you on this one as well @martinfleis, let me know if there's more discussion needed or anything I can do on my end. Thanks!

@martinfleis martinfleis merged commit 9125d5f into geopandas:master Jun 7, 2020
@martinfleis
Copy link
Member

Thank you @adriangb!

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

Successfully merging this pull request may close these issues.

None yet

4 participants