mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-19 02:07:52 +00:00
Docs: Update Gemini benchmark results
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
const processCSV = async (csvString, config) => {
|
||||
const { csvParse } = await import('https://esm.sh/d3-dsv@3');
|
||||
const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config;
|
||||
|
||||
const groups = csvParse(csvString).reduce((acc, row) => {
|
||||
if (row[fc] == fv) {
|
||||
const key = row[gb];
|
||||
const val = +row[ac] || 0;
|
||||
acc[key] = acc[key] || { sum: 0, count: 0 };
|
||||
acc[key].sum += val;
|
||||
acc[key].count++;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return Object.entries(groups).map(([key, { sum, count }]) => ({
|
||||
[gb]: key,
|
||||
result: op === 'avg' ? sum / count : op === 'count' ? count : sum
|
||||
}));
|
||||
};
|
||||
export default processCSV;
|
||||
Reference in New Issue
Block a user