ComfyUI Node

Pandas Index

Get a DataFrame's row labels out where you can see them

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Index
  • dataframe
  • PDINDEX

Every pandas DataFrame has an index - the row labels that sit to the left of your data. PandasIndex pulls that index out of a DataFrame and hands it to you as a PDINDEX object. On its own that sounds abstract, but it's the node you use when you need to know what your rows actually are: are they a boring 0..N range, or did someone load a CSV with a meaningful index column like dates or IDs?

It's part of HowToSD's ComfyUI-Data-Analysis pack, Hide Inada's wrapper set that brings pandas, matplotlib, and seaborn into ComfyUI. Same pack-wide story: no GPU, no model downloads.

How it works

The mechanism is one attribute access: dataframe.index. The node takes a DataFrame and returns its row labels as a pandas.Index. The author's docs categorize this under "DataFrame information" - it's an inspection node, not a transform. It doesn't change anything; it just surfaces metadata that's otherwise invisible in the node graph.

Here's the thing that trips people up, and the author is careful about it: the index is not the row numbers. When you load a plain CSV, pandas assigns a default 0, 1, 2... index, so it looks like row numbers - but the index is a set of labels, and it can be dates, strings, or a MultiIndex. PandasIndex gives you the labels. If you want the physical position of a row, that's a different concept entirely (the iloc family).

The output is a PDINDEX socket, which isn't a string you can read directly. To actually see it, you chain it into the pack's display nodes - the author's guide shows the Index output going into a text/show node.

The inputs that matter

Just one: dataframe. Feed it any DATAFRAME and you get its PDINDEX out. That's the whole node - which is exactly why you'd keep it around: it's a building block for when you need to know or display row labels before deciding how to filter.

Installing it

The standard pack install. ComfyUI Manager: search "ComfyUI-Data-Analysis", install, restart - dependencies (pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml) are handled automatically. Manual:

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

Then rename the folder to data-analysis if you want the example workflows to work. Pack license: custom non-commercial - personal/academic use is fine; commercial use needs written permission from the author.

Gotchas

The main gotcha is expecting to see text and getting a PDINDEX socket instead - you need PandasIndexToString (or a show node) to render it. Second: if your DataFrame has a default range index, this node returns RangeIndex(0, N)-style output, which reads as a list of numbers and tells you nothing interesting - the node earns its keep when there's a real index column. And remember, because it's labels not positions, "the fifth row" and "the row labeled 5" are different things; knowing which one you're holding is the difference between this node working and silently confusing you.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
dataframeDATAFRAME

Outputs (1)

NameTypeDescription
PDINDEXPDINDEX