ComfyUI Node

Pandas Mean

The average of every column, in one Series

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Mean
  • dataframe
  • PDSERIES

The mean is the first thing you compute on any new dataset, and in ComfyUI it's one node. Pandas Mean returns the average of each column in a DataFrame as a PDSERIES - a single pass, no scripting, no leaving the canvas. It's the summary-statistics workhorse of the pack, the node you'll likely wire into more workflows than you expect.

It comes from ComfyUI-Data-Analysis by Hide Inada (HowToSD), the extension that wraps pandas, Seaborn, and Matplotlib into ComfyUI nodes. The author's whole pitch is that structural data analysis belongs in ComfyUI's visual graph just as much as image generation does - and a mean node is the sort of thing that makes that pitch actually work. Grab your DataFrame, hit this, and you know the center of every column.

How it works

The node runs dataframe.mean(). pandas computes the arithmetic mean per column, skipping NaN values by default (so a column with a few blanks still averages the values it has). The output Series is indexed by column name. There's no axis option - it's always column-wise, always the plain mean, and if you need the median instead because your data is skewed, that's a separate node in the same family (Pandas Median).

The output type is PDSERIES, the pack's Series socket. From there: Pandas Series To DataFrame to get a row of averages you can save or plot, or feed it into Pandas Add Series / Pandas Mul Series if you're normalizing other tables against the mean.

The inputs that matter

Just dataframe. One input, one output, nothing to misconfigure. That's the whole appeal - it's a pure function you can't break.

How to install it

Same pack install as everything else:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis
pip install -r requirements.txt

Or ComfyUI Manager → search "Data analysis" → install → restart → reload. The pack's usual dependency stack (pandas, matplotlib, seaborn, scipy, scikit-learn) comes with it; no GPU, no models.

Common issues

  • A column comes back NaN - that column is all missing, or it's text. pandas won't average strings; convert the column to numeric first.
  • Mean looks wrong for your data - with outliers, the mean is misleading; that's statistics, not the node. Pandas Median is the robust choice.
  • You wanted a single number, not a Series - this returns one value per column. For a grand total across everything, restructure the data first.

There's no drama to this node, and that's exactly right. When you need the average of every column, it's there, it's fast, and it does exactly what pandas does - because it is pandas.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
dataframeDATAFRAME

Outputs (1)

NameTypeDescription
PDSERIESPDSERIES