Nodes/ComfyUI-Data-Analysis/Pandas Add Scalar Float
ComfyUI Node

Pandas Add Scalar Float

Shift every value in a DataFrame by one constant

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Add Scalar Float
  • dataframe
  • DATAFRAME
float_scalar0.00

Sometimes you don't need to add two whole tables. You need to add the same number to everything. Pandas Add Scalar Float is the cheapest possible way to do that: one DataFrame in, one float, and every numeric cell comes out bumped by that amount.

How it works

Under the hood it's literally dataframe + float_scalar. No alignment, no index juggling - a scalar broadcasts across every cell. The node's a thin wrapper over pandas addition, which is the right design: this pack's whole philosophy is "one pandas operation per node, in a graph you can see," so you don't have to remember the pandas syntax for a constant offset.

Inputs and outputs

Only three things on the node:

  • dataframe - the frame you're shifting (DATAFRAME)
  • float_scalar - the amount to add, a FLOAT field defaulting to 0, range roughly ±2³¹ (plenty)
  • Output: a DATAFRAME with every cell incremented

Wire the output into the next step - a plot, Pandas Show DataFrame, another arithmetic node - just like any other frame.

When you'd actually reach for it

A couple of realistic spots: adding a baseline or offset to a whole series of measurements before plotting (e.g., converting one scale to another, or normalizing everything up by a constant), or nudging a column you've just extracted. It's also a fine teaching node - if you want to see what "broadcast a scalar" means in pandas, drag one in and stare at the output table.

Installing it

Comes with the ComfyUI-Data-Analysis pack. From Manager: Custom Node Manager → search Data Analysis → install → restart. Or:

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

No GPU, no models to download. The pack needs pandas and friends, which Manager installs automatically - stock ComfyUI doesn't include them.

The gotcha

If your frame has any non-numeric columns, the addition throws - pandas won't add a float to a string column. Clean it up with Pandas As Float first (which also turns junk text into NaN) or select only the numeric columns before adding. And note this adds to every cell, not one column - if you only wanted to offset column price, select it first or use the row/column targeting nodes instead.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
dataframeDATAFRAME
float_scalarFLOAT0.00-2147483648–2147483648

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME