Pandas Create From Tensor
Turn a PyTorch tensor into a table you can analyze
- tens
- DATAFRAME
This is the node that connects your image-generation graph to the data-analysis side of the pack. ComfyUI is full of TENSOR objects - latent values, image feature maps, batch dimensions - and Pandas Create From Tensor is how one of those becomes a DATAFRAME you can actually analyze with pandas. The README's selling example is literally a histogram of the red-channel pixel distribution of a generated image: that pipeline starts by converting a tensor into a frame, and this is the conversion node.
The mechanism is a .numpy() call plus a pd.DataFrame wrap:
return (pd.DataFrame(tens.numpy()),)
A rank 1 tensor becomes a single-column DataFrame, rank 2 becomes rows and columns. Anything rank 3+ raises a ValueError - the same constraint as the NumPy sibling, because higher-dimensional data has no clean tabular shape. Squeeze before you feed if you're getting errors from a stray channel or batch dimension.
The big gotcha: this node needs a second pack
Read the README's March 2025 note carefully: all PyTorch wrapper nodes were moved out of this extension into ComfyUI-Pt-Wrapper (also by HowToSD). The TENSOR type itself, and the nodes that produce it, now live there. So while this node ships in ComfyUI-Data-Analysis, the thing that feeds its tens input comes from the companion extension. Install both:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis
pip install -r requirements.txt
# then the companion for the TENSOR side:
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper.git
There's a second, sneakier trap in the .numpy() call: it fails on CUDA tensors. NumPy can't read a GPU tensor directly, so if your tens input is a tensor still living on the GPU, you'll get a "can't convert cuda:0 device type tensor to numpy" error. Get it to CPU first - .cpu() - before it reaches this node. On a typical image pipeline you'll want to squeeze to rank 2 and convert to CPU, then let pandas take over.
Inputs and outputs
Required: tens (TENSOR). Output: DATAFRAME. No other knobs. It's a type-conversion node, thin on purpose. Once you're in DataFrame-land you can wire into Pandas Show DataFrame, plotting nodes, or any analysis node in the pack.
Install
The pack install is the usual ComfyUI story - Manager (search "Data analysis") or manual clone as above - and remember the mv to lowercase data-analysis or example workflows break. Restart ComfyUI after installing. No GPU needed for the analysis side; just don't feed it one on the tensor side.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| tens | TENSOR | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |