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

Enable level arguments for groupby #2115

Open
kain88-de opened this Issue Oct 21, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@kain88-de
Member

kain88-de commented Oct 21, 2018

Is your feature request related to a problem? Please describe.
groupby doesn't accept a level argument like molecule or segment.

Describe the solution you'd like
It would be nice if ag.groupby(['molecule', 'resid']) would just work. If the molecule level can have names they should be used as keys, otherwise, a simple integer counter should be enough. This would lift split and groupby to over the same functionality. I like this because similar function accepts a similar input.

Additional context
https://www.mdanalysis.org/docs/documentation_pages/core/groups.html?highlight=split#MDAnalysis.core.groups.AtomGroup.split

If groupby supports level arguments then split can be replaced with ag.grouby(level).values. A consequence of this would be that split could work with topoAttrs as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment