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

[describe-] collect aggr funcs that operate on list of values in Dict #2009

Merged
merged 2 commits into from
Sep 9, 2023

Conversation

anjakefala
Copy link
Collaborator

@anjakefala anjakefala commented Aug 26, 2023

In draft until #2008 is merged. We need to make sure the tests are all green. This is needed to fix the vgit build.

aggregator() converts a func, which operates on a list, into a _func, which operates on a srccol and a list of rows.

The original functions were then added into Globals, but this caused problems for a function like sum() which appears naturally in Python code.

I created an OrderedDict, and named it aggregators_vals as a place to store them.

Other possible options:

  • We could include the optional funcvals along with func(srccol) for Aggregator. Describe Sheet could then grab the funcvals if it exists.

  • Describe Sheet could pass the srccol and list of rows, instead of vals. This is not ideal because it means for each aggregator, we call getValues once-more. This would cause a performance degradation.

  • Add them to vd.aggregators, possibly with the suffix "_vals", and create an Aggregator out of them as well. Have Describe Sheet pull aggrname_vals.

  • Similarly use the vd.aggregator_vals, but have a less terrible name.

Optional: Do we want to do the work of porting quantiles and percentiles to be useable by Describe Sheet? Currently, an aggregator that does not go through aggregator() is not useable by Describe Sheet.

@anjakefala anjakefala marked this pull request as draft August 26, 2023 00:55
@anjakefala anjakefala requested a review from saulpw August 26, 2023 00:57
@anjakefala anjakefala marked this pull request as ready for review August 26, 2023 01:25
@anjakefala anjakefala force-pushed the aggr-globals branch 3 times, most recently from 3f4b292 to f32c229 Compare August 29, 2023 14:47
@anjakefala anjakefala marked this pull request as draft August 30, 2023 03:26
@anjakefala
Copy link
Collaborator Author

@geekscrapy noticed weird behaviour here: #2013 I am marking this PR as draft until this issue is resolved.

@anjakefala anjakefala marked this pull request as ready for review August 30, 2023 05:14
visidata/aggregators.py Outdated Show resolved Hide resolved
anjakefala and others added 2 commits September 1, 2023 19:32
…redDict

aggregator() converts a func, which operates on a list, into a _func,
which operates on a srccol and a list of rows.

The original functions were then added into Globals, but this caused problems for
a function like `sum()` which appears naturally in Python code.

I created an OrderedDict, and named it aggregators_vals as a place to
store them.

Other possible options:

* We could include the optional funcvals along with func(srccol) for
Aggregator. Describe Sheet could then grab the funcvals if it exists.

* Describe Sheet could pass the srccol and list of rows, instead of
vals. This is not ideal because it means for each aggregator, we call
getValues once-more. This would cause a performance degradation.

* Add them to vd.aggregators, possibly with the suffix "_vals", and
create an Aggregator out of them as well. Have Describe Sheet pull
aggrname_vals.

* Similarly use the vd.aggregator_vals, but have a less terrible name.

Optional: Do we want to do the work of porting quantiles and percentiles to be useable by Describe Sheet? Currently, an aggregator that does not go through aggregator() is not useable by Describe Sheet.
@saulpw saulpw merged commit d7204d8 into develop Sep 9, 2023
11 checks passed
@anjakefala anjakefala deleted the aggr-globals branch September 9, 2023 04:10
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.

2 participants