Pandas Pow Scalar Int
Pandas Pow Scalar Int
- dataframe
- DATAFRAME
Pandas Pow Scalar Int is the squaring node. Give it a DataFrame and an integer, and it raises every cell to that power - 2 squares the whole table, 3 cubes it, 1 does nothing, 0 turns everything into 1 (except zeros, which stay 0, because that's how integer math works). It's a one-trick node, but it's the right tool when you want to emphasize larger values across a dataset before you plot or compare.
It comes from HowToSD/ComfyUI-Data-Analysis, the extension that wraps pandas as ComfyUI nodes. This is one of the pack's Arithmetic method family - there's a float-powered twin if you need fractional exponents, a Series variant, and a full DataFrame-to-DataFrame version. For most practical work the integer scalar version is the one that's actually convenient.
How it works
The mechanism is a single pandas call: dataframe.pow(int_scalar). Element-wise exponentiation, plain and simple - the integer applies to every cell, no alignment logic, no index juggling, no state. The INT field defaults to 1 (identity) and clamps to the range -2^31 to 2^31. Since the exponent is an integer, negative bases behave the way math says they should: (-2) ** 2 is 4, (-2) ** 3 is -8. That's actually a meaningful difference from the float version, which will hand you NaN for fractional powers of negative numbers.
Inputs and output
dataframe- the table being raised.int_scalar- the power, an INT, default1.
Output: a DATAFRAME of identical shape with each cell raised to the power. It feeds into any other node in the pack - plot it, save it, or keep transforming.
Installation
Same as every node in this pack, so if you've already got the pack installed you're done. Otherwise, ComfyUI Manager is easiest - search Data analysis in the Custom Node Manager and install ComfyUI-Data-Analysis. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis # examples expect this folder name
pip install -r requirements.txt
Restart ComfyUI, reload the page. The dependencies are the standard data stack - pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml - all CPU-only. No GPU, no model downloads. PyTorch wrapper nodes live in a separate extension since March 2025.
When to use it
Reach for this when you want to magnify differences: squaring a table of residuals or error values makes the outliers pop before you visualize. And there's one genuinely useful trick - raising a table of booleans or 0/1 flags to the power 0 converts zeros to ones and ones to ones... wait, no, both become 1. Don't do that. The honest use is squaring/cubing for emphasis. And if you need a fractional power, use Pandas Pow Scalar Float instead - it does everything this node does plus the fractions.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — | |
| int_scalar | INT | 1-2147483648–2147483648 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |