Pandas Sub Scalar Int
Subtract a whole number from every row
- dataframe
- DATAFRAME
Pandas Sub Scalar Int subtracts one integer from every cell in a DataFrame. It's the integer-flavored sibling of Pandas Sub Scalar Float - same shape, same idea, different knob - and it's the one you want when your offset is a clean whole number and you'd like your result to stay integer too.
It's a small node, so let's be honest about when it earns its place. If you've got a count column that starts at 1 instead of 0 and you want zero-indexing, this does it in one step. If a column of IDs or ranks is shifted and you need to remove a fixed offset, same. It's also handy for the classic "subtract the minimum so my smallest value is 0" move - grab the min from a summary node, type it in, done. For any of these, if the offset could be fractional, you actually want the float version; this one only accepts a whole number.
How it works
dataframe - int_scalar, plain broadcasting. No alignment games, no axis selector - one constant across the whole frame. Since both sides are integers, the result normally stays integer dtype, which is the one real difference from the float variant. Nothing else about the behavior differs: it's pure elementwise subtraction.
Inputs and outputs
dataframe(DATAFRAME) - the frame to shift.int_scalar(INT, default 0) - the whole number to subtract from every cell.
Output: a single DATAFRAME, shifted down by the constant.
Installing this pack
This node ships in ComfyUI-Data-Analysis by Hide Inada (HowToSD). CPU-only, no GPU, no model downloads - but the pack needs its Python stack, which stock ComfyUI lacks: pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml.
ComfyUI Manager: Manager → Custom Node Manager → search "Data analysis" → install ComfyUI-Data-Analysis → restart ComfyUI and refresh the browser. Manager installs the deps.
Git clone:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis # example workflows depend on this folder name
pip install -r data-analysis/requirements.txt
Restart ComfyUI after installing.
Troubleshooting
- The field won't take a decimal. Right - that's the float node's job. If your offset is fractional, use
Pandas Sub Scalar Float. - String columns raise. Numeric arithmetic on text fails; keep this node on numeric frames.
- "Wait, which is minuend?" The frame is on the left of the minus sign: result = dataframe − scalar. There's no ordering to mix up.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — | |
| int_scalar | INT | 0-2147483648–2147483648 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |