ComfyUI Node

Pandas Median

The average that survives your outliers

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

If your data has outliers - and your data has outliers - the mean is lying to you. Pandas Median is the version of "average" that doesn't flinch: it returns the middle value of each column, one per column, as a PDSERIES. One extra node is the difference between "our average spend is $2,400" and "the typical spend is $47." Reach for this when the numbers look weird.

It's part of ComfyUI-Data-Analysis, the pack from Hide Inada (HowToSD) that wraps pandas, Seaborn, and Matplotlib into ComfyUI nodes. The summary-statistics family - Min, Mean, Median, Max, Mode, and friends - is where you get a feel for a dataset, and the median is the honest member of that family.

How it works

The node runs dataframe.median(). pandas sorts each column and takes the middle value (averaging the two middle values for even-length columns), skipping NaN by default. The result is a Series indexed by column name, one median per column. No axis option, no configurable parameters - column-wise median, always.

Output is a PDSERIES, same socket as the other summary nodes. It wires into Pandas Series To DataFrame to become a row in a table, or into any node that takes a Series. If you find the median differs wildly from Pandas Mean, that gap is itself a useful signal - it's telling you your data is skewed.

The inputs that matter

One input: dataframe. That's the whole node. The lack of knobs is a feature - you can't accidentally change what "median" means.

How to install it

Standard pack install:

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 brings pandas, matplotlib, seaborn, scipy, and scikit-learn with it - no GPU, no model downloads.

Common issues

  • NaN for a column - it's all missing or all text. Clean the column to numeric first.
  • Median vs mean disagreement - not a bug, it's information. A big gap means heavy tails; that's when you want the median, which is exactly why you're here.
  • A Series out, but you wanted a number - for a single overall median, reshape the data into one column first.

The median is the unsung hero of summary stats, and this node does nothing but hand it to you. That's enough.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
dataframeDATAFRAME

Outputs (1)

NameTypeDescription
PDSERIESPDSERIES