Pandas Mul
Multiply two DataFrames, cell by cell
- a_dataframe
- b_dataframe
- DATAFRAME
Some operations happen to whole tables at once, and multiplication is one of them. Pandas Mul takes two DataFrames and multiplies them element by element - each cell in the first frame by the matching cell in the second - returning a new DataFrame. It's the "apply this across everything" node for scaling, weighting, or combining two aligned tables.
It comes from ComfyUI-Data-Analysis, Hide Inada's (HowToSD's) pack that wraps pandas, Seaborn, and Matplotlib into ComfyUI nodes for data analysis in the same canvas as image generation. Pandas Mul is a direct wrapper around pandas' DataFrame.mul(), and it's the frame-versus-frame member of a family that also includes scalar and Series variants.
How it works
The node calls a_dataframe.mul(b_dataframe). pandas aligns the two frames on their labels (index and columns) and multiplies where they line up. Cells that don't align - or involve NaN - come out NaN. This is why it works beautifully when the second frame is derived from the first (like a weight table), and silently produces a field of NaN when the two tables have unrelated labels.
The output is a DATAFRAME of the same shape. This is different from the scalar nodes: here both operands are full tables, so you're combining structures, not scaling by a constant. If that's actually what you need, Pandas Mul Scalar Float or Pandas Mul Scalar Int is the simpler tool.
The inputs that matter
a_dataframe- the first frame.b_dataframe- the second frame to multiply against it.
Both are required DATAFRAMEs, and output is a DATAFRAME.
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's dependencies (pandas, matplotlib, seaborn, scipy, scikit-learn) install with it; no GPU, no model files.
Common issues
- Everything comes back
NaN- the two frames' labels don't align. pandas multiplies by label, not by position. Make sure the second frame shares the first one's index and column names (derive it from the first frame and you're safe). - Shape mismatch surprises - same root cause, different symptom. Two DataFrames of different dimensions won't align the way you hope.
- You're multiplying by one number - that's the scalar nodes' job. Using frame-vs-frame for a constant is like using a freight train for a grocery run.
The rule of thumb across this pack's arithmetic: whole table against whole table → Pandas Mul; against a number → scalar variant; against one column's worth of values → Pandas Mul Series.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a_dataframe | DATAFRAME | — | |
| b_dataframe | DATAFRAME | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |