Pandas Mul Series
Multiply a DataFrame by one row's worth of values
- a_dataframe
- b_series
- DATAFRAME
Sometimes you don't want to multiply by one number, and you don't have a second whole table either - you've got one row of weights, or one column of factors, and you want it applied across a DataFrame. Pandas Mul Series is the middle option: multiply a DataFrame by a single pandas Series, element by element, aligning on labels. Weight each column by its own factor, or scale every row by a matching vector - that's this node's lane.
It comes from ComfyUI-Data-Analysis by Hide Inada (HowToSD), the pack that wraps pandas, Seaborn, and Matplotlib into ComfyUI nodes. It's a thin wrapper over pandas' DataFrame.mul(series), sitting between the scalar multiply nodes and the frame-vs-frame Pandas Mul.
How it works
The node runs a_dataframe.mul(b_series). pandas aligns the Series against the DataFrame's labels - typically by column name - and multiplies each column by its matching Series value. Where labels don't match, you get NaN. So a Series indexed by column names gives you per-column scaling; a Series aligned by row index gives per-row scaling. Alignment is doing the real work here, and alignment is also where things go wrong.
The practical path: get a Series out of Pandas Mean, Pandas Max, or Pandas Loc Row Series, feed it here, and you've normalized or weighted a whole table by one row's worth of numbers. That's the trick people actually use this for - divide (or multiply) every column by its own mean without building a second table.
The inputs that matter
a_dataframe- the frame to scale.b_series- aPDSERIESproviding the per-label factors.
Output is a DATAFRAME, same shape, labels aligned.
How to install it
Same 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. Standard pack dependencies (pandas, matplotlib, seaborn, scipy, scikit-learn); no GPU, no models.
Common issues
NaNcolumns that should have values - the Series' index doesn't line up with the DataFrame's labels. Check that the Series is indexed by the same names as your columns (or rows), depending on what you're scaling.- Wrong direction - a Series indexed by column names scales per-column; indexed by rows, per-row. Build the Series with the alignment you intend.
- Mixing up siblings - scalar for a constant, this node for a vector of factors, frame-vs-frame for two full tables. Wrong pick = wrong shape of result.
This is the node that makes "normalize each column by its own mean" a two-node pipeline instead of a detour through a script. Learn the alignment rule and it's a workhorse.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a_dataframe | DATAFRAME | — | |
| b_series | PDSERIES | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |