Aggregate Number List
Turn a list of numbers into the one number you actually wanted
- numbers
- float
- int
- count
Your directory loader just handed you a list of FPS values - one per file - and the node you're feeding wants a single number. Somewhere in the middle of "list of numbers" and "one number" sits a gap that most workflows paper over with a calculator and a hardcoded value. Aggregate Number List is that gap, filled in. It's a tiny reduce function from SineSwiper's LoadAnim-Adv pack: take a list of numbers, apply a function, get one number (plus an int version and a count).
What it does
Input numbers (a list of NUMBER/FLOAT/INT - which in ComfyUI means it has to come from a node that emits lists, usually marked with a multi-box icon, or continued along a list-processing chain), plus a function dropdown with eight options:
average,median,sum,prod,min,max,first,last
The README's canonical example is averaging FPS values from multiple files - exactly the case the directory loader produces: a list of per-file FPS where the flattened output is already averaged for you but the un-flattened list is not. This node is the manual version, and it's more honest than the automatic one.
Three outputs: float (the result as a float), int (rounded), and count (how many numbers went in). Handy because count is genuinely useful downstream - it's how you'd know "I processed 14 files" without counting list entries by hand.
How it works
Under the hood it's numpy: the list becomes a float array, the function applies via numpy's average/median/sum/prod/min/max, and the result comes back as both float and rounded int. first and last skip the math entirely and just grab the edge of the list. Empty input returns (0.00, 0, 0) rather than erroring, which is a sensible bit of defensiveness.
When you'd reach for it
- Averaging FPS from a multi-file load before wiring into a scheduler.
- Summing frame counts to budget total frames against VRAM.
- Getting
max/minof a list of batch sizes or seeds for validation. - Reducing any list output that a non-list node can't accept - this is the classic "list-to-single" adapter.
Inputs and outputs
Inputs: numbers (required, list), function (enum, default average). Outputs: float (FLOAT), int (INT), count (INT). Short and to the point.
Installing
Part of ComfyUI-LoadAnim-Adv by SineSwiper. ComfyUI Manager → search "LoadAnim", or:
cd ComfyUI/custom_nodes
git clone https://github.com/SineSwiper/ComfyUI-LoadAnim-Adv.git
Restart ComfyUI. No models; dependencies are just torch, numpy, Pillow.
Gotchas
- The input must actually be a list. A single scalar won't aggregate - you'll get a 1-element list and a somewhat pointless average. That's on your upstream wiring, not the node.
intis a straightround(). If you average 10.5 fps you getint= 10 (banker's rounding aside, it rounds to nearest). Usefloatif precision matters.first/lastignore everything but the edge - useful, but easy to confuse withmin/maxat a glance. Read the dropdown.
It's not going to win any awards, but the day you're staring at a list of 40 FPS values and a node that wants one number, this is the difference between a clean graph and a calculator.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| numbers | NUMBER,FLOAT,INT | Number set to reduce. Must have come from a node that supports list processing (usually marked with a multi-box icon), or was continued from a similar node in a chain. | |
| function | COMBO | average | Function to apply to the numbers. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | The aggregated number, as a float. |
| int | INT | The aggregated number, as an integer. |
| count | INT | The count of numbers from the initial input. |