Pandas Columns
Stop guessing what your columns are called
- dataframe
- PDINDEX
Pandas Columns exists because of one dumb, universal moment: you load a CSV into a DataFrame and have no idea what the columns are called. In a Jupyter notebook you'd just glance at the frame. In ComfyUI there's no head() hovering around, so you're left squinting at a file you didn't write, trying to remember if the field is "Hits" or "hits" or "HITS (season)". This node hands you the answer.
It's one of the small, unglamorous nodes in the ComfyUI-Data-Analysis pack - HowToSD's collection that turns Pandas into a visual graph. Its official job: "Retrieves the column labels of a pandas DataFrame." It's the kind of utility that looks trivial until every other node you use starts asking for column names as strings and you need ground truth.
How it works
Under the hood it's a one-liner: the node takes your DataFrame and returns dataframe.columns. That's a pandas Index object, which the pack routes through a custom PDINDEX socket type. No magic, no copies - you get the actual column labels from the frame you fed in.
That PDINDEX type is worth understanding. It's not a standard ComfyUI data type; it's defined by this pack. So the output is consumable by the pack's own display nodes - notably Pandas Show Index or Pandas Show Text - and by other Pandas nodes that accept an index. You can't drag it into an arbitrary text node from a different pack and expect it to work, because that node doesn't know the type.
Inputs and outputs
- dataframe (required,
DATAFRAME) - any DataFrame: loaded with Pandas Load CSV, built with Pandas Create, or the result of a transform like Pandas Fill NA. - PDINDEX output - the column labels as a pandas Index. Wire it into Pandas Show Index (or Pandas Show Text) to see the names on screen.
When you'd actually use it
The honest use case is orientation. Load an unfamiliar CSV, run Pandas Columns into a show node, and you instantly know what to type into every downstream column_name field. The README's flagship baseball example is a good model for the overall flow: load the stats file, use nodes like this to discover structure, then filter and aggregate toward the answer (who had the most hits per year).
The pack's own user guide pairs it with Pandas Index (which does the same thing for row labels) and points out that these are "JSON-serialized Index" objects meant to be viewed through a show node.
Installing it
Same as every node in this pack - you install the pack once. In ComfyUI Manager search "Data analysis" and install ComfyUI-Data-Analysis, then restart and reload the browser. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis
mv ComfyUI-Data-Analysis data-analysis
pip install -r data-analysis/requirements.txt
That requirements file is the real install surface: pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml. None ship with base ComfyUI, and pandas/matplotlib in particular are non-negotiable for this pack. No GPU, no model downloads - this is pure CPU data work.
Gotchas
- The output is pack-typed. Remember
PDINDEXisn't universal; if a node from another pack refuses the wire, that's why. - It won't show you the data, just the names. Column labels are metadata. If you want to eyeball the actual rows, use Pandas Show Data Frame instead.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PDINDEX | PDINDEX | — |