Pandas Add Scalar Int
Add one integer to every cell — the non-float cousin
- dataframe
- DATAFRAME
This is the integer version of Pandas Add Scalar Float, and honestly, that's most of what you need to know. It takes a DataFrame, adds a whole number to every cell, and hands you back a new DataFrame. If you've already read the float one, skim the rest - the differences are in the details.
How it works
dataframe + int_scalar, broadcast across all cells. Identical mechanism to the float variant, just with an INT input instead of a FLOAT one. Where it matters: integer arithmetic stays integer. Add 1 to a column of whole counts and you get whole counts back - no trailing .0 appearing in your data. If your column was already float, pandas will quietly give you a float result, which is fine and normal.
Inputs and outputs
dataframe- the frame to shift (DATAFRAME)int_scalar- the integer amount, default 0- Output: a
DATAFRAMEwith the offset applied
That's the whole node. Two inputs, one output, no optional maze to wander through.
When it earns its keep
Counting-heavy data mostly. Bumping batch sizes, row numbers, or any integer column by a fixed amount; converting 0-based indices to 1-based for display; offsetting a histogram's bin labels before you feed it into one of the pack's Seaborn plotting nodes. If your values could ever be fractional, use the float version instead and save yourself the Int64 vs float64 dance downstream.
Installing it
Part of ComfyUI-Data-Analysis (author: Hide Inada / HowToSD.com). Via Manager: search Data Analysis → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis
pip install -r data-analysis/requirements.txt
The mv rename matters - the example workflows hard-code the data-analysis folder name. No GPU needed; pandas/matplotlib/seaborn come via requirements.
Gotchas
Same as the float twin: non-numeric columns will make it throw, so convert first. And one subtlety with ints - if you add an int to a column that holds NaN, pandas will often promote it to float anyway because NaN can't live in an integer column. If you want integer output and missing values, you'll want the nullable Int64 dtype, which you can get from Pandas As Int before adding.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — | |
| int_scalar | INT | 0-2147483648–2147483648 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |