Pandas Div
Divide one DataFrame by another, alignment and all
- a_dataframe
- b_dataframe
- DATAFRAME
Pandas Div is the pack's "divide two tables" node - element-wise, cell by cell. If you have a DataFrame of raw counts and a DataFrame of totals and you want per-cell ratios, this is the node. It's part of a full arithmetic family in the pack (add, subtract, multiply, power all have siblings), and division is the one that most often needs the careful version rather than the scalar shortcut.
The mechanism is a single call:
df_out = a_dataframe.div(b_dataframe)
which is just pandas' true division. Inputs are a_dataframe (the numerator) and b_dataframe (the denominator); output is a DATAFRAME of the result. And because this is pandas, not numpy, the two frames are aligned on index and columns - pandas matches rows by index label and columns by column label before dividing. That's usually exactly what you want, and it's also where people get confused.
The alignment gotcha
If the two DataFrames don't share the same index labels and column names, pandas doesn't fail - it aligns what it can and fills the rest with NaN. So a one-character typo in a column name doesn't error out; it silently produces a column of NaN. That's the trap: the node will happily divide two "different" tables and hand you mostly-empty results with no complaint. If your division output looks suspiciously full of NaN, check that both frames have identical index and column labels, not just matching shapes.
Division by zero is the second thing to expect: pandas returns inf (or NaN where 0/0) rather than raising. If you're dividing by counts that can be zero, downstream nodes will see infinities - filter or fill them before plotting, or every chart axis will explode.
When to use which division node
The pack splits this one way, and the split is worth knowing:
- Pandas Div - DataFrame ÷ DataFrame, full alignment semantics.
- Pandas Div Series - DataFrame ÷ Series, divides each column by the Series.
- Pandas Div Scalar Float / Scalar Int - DataFrame ÷ a single number, the simplest and most common case.
If you just need to scale a table by a constant, skip this node entirely and use the scalar versions. Reach for Pandas Div when the denominator genuinely is another table - per-category totals, normalization frames, benchmark baselines.
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. No GPU, no model files. Just pandas, which the pack installs for you.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a_dataframe | DATAFRAME | — | |
| b_dataframe | DATAFRAME | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |