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

ENH: support area-weighted mean in dissolve #3028

Open
martinfleis opened this issue Sep 25, 2023 · 5 comments · May be fixed by #3229
Open

ENH: support area-weighted mean in dissolve #3028

martinfleis opened this issue Sep 25, 2023 · 5 comments · May be fixed by #3229

Comments

@martinfleis
Copy link
Member

Dissolve offers all aggregations supported by pandas groupby as well as custom functions, but neither of those can easily do area-weighted mean, which is what you'd need when dealing with intensive variables.

We should figure out a way of supporting that. It would ideally be an option in aggfunc, if that wouldn't get too complex due to variability of what aggfunc can consume.

@alhridoy
Copy link

Hi @martinfleis
I'm interested in working on this enhancement. Is anyone else already looking into it? Any initial guidance or suggestions are appreciated.

@Macko94
Copy link

Macko94 commented Nov 3, 2023

Any updates on this feature?

@martinfleis
Copy link
Member Author

I don't think so. If you'd like to give it a go, please do.

@nicholas-ys-tan
Copy link
Contributor

nicholas-ys-tan commented Mar 25, 2024

hi @martinfleis,

I noted this issue had gotten a bit stale so thought I might put forward an approach to it. It's preliminary and rough but I think it shows what I'm thinking of:

https://github.com/nicholas-ys-tan/geopandas/tree/issue3028

It is however, quite dissatisfying that the adjustments are made at 2 parts within the function to create an area-weighted mean, but it does preserve the use of aggfunc and any kwargs that may be passed in.

Keen to hear your thoughts and feedback, if you think this is an appropriate direction, I'll do some refining, tests and documentation to go with it.

@martinfleis
Copy link
Member Author

@nicholas-ys-tan Can you turn it into a draft pull request? It will be easier to review and comment code.

@nicholas-ys-tan nicholas-ys-tan linked a pull request Mar 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants