Nodes/ComfyUI-Data-Analysis/Pandas Index To String
ComfyUI Node

Pandas Index To String

Turn a DataFrame's index into text you can actually read

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Index To String
  • index
  • STRING

PandasIndexToString is the display companion to PandasIndex: it takes a pandas Index and converts it to a plain string you can read, show, or pipe into other nodes. If you've ever grabbed a DataFrame's index and been handed an opaque PDINDEX socket that refuses to render, this is the node that fixes it.

It's part of HowToSD's ComfyUI-Data-Analysis pack, Hide Inada's wrapper set that drops pandas, matplotlib, and seaborn into ComfyUI's node graph. No GPU, no models - same story as the rest of the pack.

How it works

The mechanism is dead simple: str(index). The node receives a PDINDEX, calls Python's string conversion on it, and returns the result as a STRING. That means the exact output format is whatever pandas' Index __str__ produces - for a default range index that's something like RangeIndex(start=0, stop=200, step=1), and for a loaded index column it's the labels you'd see in a printed table.

The author files this under "Display data," which is the right mental model. It's not doing any transformation or analysis - it's the render step. In a typical mini-workflow you chain: a load or create node → PandasIndex (gets the PDINDEX) → PandasIndexToString (renders it) → a show/text node so it's visible on the canvas.

The inputs that matter

Just one input: index, typed PDINDEX. It's usually wired straight from a PandasIndex node's output. The single output is the STRING representation of that index.

That's genuinely all there is to configure, which is the point - this is a utility node that exists to close a type gap in the pack.

Installing it

Standard pack install. ComfyUI Manager: search "ComfyUI-Data-Analysis", install, restart - pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, and lxml get installed for you. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
pip install -r requirements.txt

Rename the folder to data-analysis so bundled example workflows load. And the pack-wide license note: it's a custom non-commercial license - personal and academic use is fine, commercial use needs the author's written permission.

Gotchas

Don't expect pretty CSV formatting. str(index) gives you a compact one-line representation like Index(['2024-01-01', '2024-01-02'], dtype='object') - useful for reading, not for parsing. If you need the labels as a list or to feed them into another node, look for a JSON/list conversion node in the pack instead. And on a default-loaded CSV the index is just RangeIndex(start=0, stop=N, step=1), which is honest but boring - this node is worth the two extra wires when your index actually means something.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
indexPDINDEX

Outputs (1)

NameTypeDescription
STRINGSTRING