Pandas Sin
Apply sine to a whole DataFrame, non-numeric cells become NaN
- dataframe
- DATAFRAME
Sometimes you need to bend your numbers before you can use them. Pandas Sin applies the sine function to every cell of a DataFrame, and it's honest about what it can't handle: any cell that isn't numeric gets converted to NaN first. It's a math/transform node, pure and simple - feed it a numeric DataFrame, get back a DataFrame where every value is sin(value).
Why would you reach for this in ComfyUI? Feature engineering, mostly. If you're doing a real data-analysis workflow - the kind this pack exists for - sine transforms are a standard trick for cyclic signals: angles, hours of the day, seasons, anything periodic that you want to map into a smooth [-1, 1] range instead of leaving as a jagged 0–23 integer. Combined with the pack's Matplotlib and Seaborn nodes, it lets you prep data visually before plotting. Nobody's wrapping image-generation latent space in this; that's not the job.
How it works
The source is three lines of intent. It first runs dataframe.apply(pd.to_numeric, errors='coerce') - that coerces every column to numeric and turns anything that can't be parsed into NaN. Then it applies np.sin across the frame. So the order matters: garbage doesn't error out, it becomes missing data that will then ripple through any downstream stats node as NaN.
Inputs and outputs
dataframe(DATAFRAME) - the frame to transform. Only numeric columns survive meaningfully.
Output is a single DATAFRAME with the sine applied. Wire it into plotting nodes (e.g. SNS Line Plot), a Pandas Summary if you want to sanity-check the distribution, or Pandas To Numpy if you're heading into the numpy side of the graph.
Installing this pack
This node ships in ComfyUI-Data-Analysis by Hide Inada (HowToSD) - a CPU-only pack with no GPU and no model downloads. It does bring its own Python requirements since stock ComfyUI lacks pandas and friends: 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 rely on this folder name
pip install -r data-analysis/requirements.txt
Restart ComfyUI after installing.
Troubleshooting
- My whole column came back NaN. That column wasn't numeric - the
to_numericcoercion killed it. Check the data type upstream; usePandas As Floator a cleaning step before feeding it in. - NaN everywhere downstream. Sine of a non-numeric frame produces a mostly-NaN frame, and most pandas stats (sum, mean) silently skip NaN. If your summary looks empty, your input wasn't numeric to begin with.
- It's a transform, not a filter. Every cell is processed; there's no axis or column selector here. If you only want to transform one column, select it first or transform the whole frame.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |