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

Sorting Contribution Analysis tables better #887

Open
marc-vdm opened this issue Nov 27, 2022 · 0 comments · May be fixed by #1046
Open

Sorting Contribution Analysis tables better #887

marc-vdm opened this issue Nov 27, 2022 · 0 comments · May be fixed by #1046
Labels
feature Issues/PRs related to a new feature good first issue Issues to get started with AB development with prio:low Issues that are low priority
Milestone

Comments

@marc-vdm
Copy link
Member

marc-vdm commented Nov 27, 2022

Currently, results tables in EF contributions and Process contributions sort the data (and also the graphs) based on the first data (numbers) column large >> small. While this is nice, it may be nicest to sort on the larges contributor in total. We could achieve this by temporarily creating a new column in the pandas df that takes the max() of the row, and sort the table on that. As these tables are generally not large, this extra step should not take any meaningful time.

Sorting the data like this would allow AB to show data based on the most relevant contributors in general, not just for the first process shown. e.g. the figure below, which is sorted on the lowest bar in the graph (and first column):
image

We could instead sort on the largest contributors in total, like the excel example below:
image

This should be done here:

top_contribution = ca.sort_array(C[col, :], limit=limit, limit_type=limit_type)

ca.sort_array() both sorts and filters the data. We can re-sort afterwards with the improved sorting.

we can sort like this (source):

maxCol = lambda x: max(x.min(), x.max(), key=abs)

For the second sorting on this col, we can assume almost sorted arrangement, and thus we should use Timsort, as explained here

@marc-vdm marc-vdm added feature Issues/PRs related to a new feature prio:low Issues that are low priority labels Nov 27, 2022
@marc-vdm marc-vdm added the good first issue Issues to get started with AB development with label Sep 14, 2023
@marc-vdm marc-vdm added this to the 2.9.2 milestone Oct 11, 2023
@marc-vdm marc-vdm modified the milestones: 2.9.2, 2.9.3 Oct 21, 2023
@marc-vdm marc-vdm modified the milestones: 2.9.3, 2.9.4 Nov 22, 2023
@mrvisscher mrvisscher removed this from the 2.9.4 milestone Jan 9, 2024
@marc-vdm marc-vdm linked a pull request Jan 11, 2024 that will close this issue
5 tasks
marc-vdm added a commit to marc-vdm/activity-browser that referenced this issue Sep 29, 2024
Add:
- CA data: use actual total instead of sum(abs)
- CA data: make distinction between positive and negative rest values (LCA-ActivityBrowser#886)
- CA data: sort based on average of row instead of first column (LCA-ActivityBrowser#887)
- CA table: consistent dropping of empty (rest) rows (LCA-ActivityBrowser#1044)
- CA figure: add marker to show total score when both positive and negative results present (LCA-ActivityBrowser#647)
@marc-vdm marc-vdm mentioned this issue Sep 29, 2024
7 tasks
@marc-vdm marc-vdm added this to the 2.11.0 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues/PRs related to a new feature good first issue Issues to get started with AB development with prio:low Issues that are low priority
Projects
None yet
2 participants