How do I groupBy() over the filtered set of rows

Hi.
In my js-viewer, I’m migrating from manual processing of each cell to the groupBy() feature. But the lack of ability to aggregate over the filtered sub-set of the data limits me. Is that possible to implement it on your side?

Indeed this feature was missing, we’ve just added it. Use whereRowMask method to provide the bitset, just like that:

// Aggregations
let demog = grok.data.demo.demog();
demog.selection.init((i) => i % 2);

let avgAgesByRace = demog
    .groupBy(['race', 'sex'])
    .whereRowMask(demog.selection)
    .avg('age')
    .aggregate();

grok.shell.addTableView(avgAgesByRace);
1 Like

Absolutely love it! Thanks for the quick feedback!

Can you also help me with How do I get hover filter please?

I just need both of the pieces to get my job done.

Yes I remember about the hover filter, I took a stab at it but it turned out to be not trivial. We don’t keep it as a bitset internally (but rather as a predicate function based on the row index), there were performance reasons for that but perhaps it’s time to make it consistent with the selection and filter.

1 Like

That’s good to know. I didn’t know you’ve looked into it.