Nodes/ComfyUI-Data-Analysis/Pandas Select Columns
ComfyUI Node

Pandas Select Columns

Pandas Select Columns

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Select Columns
  • dataframe
  • DATAFRAME
column_names

Almost every real dataset has columns you don't care about, and carrying them around makes everything slower and noisier. Pandas Select Columns is the trim: type the column names you want, comma-separated, and get back a DataFrame containing only those. It's the node you drop right after loading a CSV when you've got 30 columns and need 4. If you want to keep a table-shaped result, this is the node - the pack's Select Column As Series exists for the case where you want one column as a one-dimensional Series instead.

It's part of HowToSD/ComfyUI-Data-Analysis, the pandas-in-ComfyUI extension, under its Data subset selection category.

How it works

The column_names field is a comma-separated STRING that the node splits, trims, and validates against the DataFrame's actual columns - the shared helper even handles numeric column labels by converting numeric strings to integers when they match. Then it does dataframe[selected_columns]. Two behaviors worth knowing: unknown column names raise a ValueError instead of being silently dropped (good - no accidental data loss), and the output keeps its row order and index intact. The order you list the columns is the order they come out in, so you can use this node to rearrange columns, not just subset them.

Inputs and output

  • dataframe - the source.
  • column_names - comma-separated labels, e.g. player, year, hits.

Output: a DATAFRAME with exactly those columns, in your listed order.

Installation

Standard for the pack. ComfyUI Manager: search Data analysis, install ComfyUI-Data-Analysis. Or:

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 name
pip install -r requirements.txt

Restart, reload. Deps: pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml. No GPU, no models.

The gotchas

Exact names again - this is free-text, not a dropdown, so a column called R and a column called r are different things, and any typo errors out the whole workflow. That's actually a feature: it surfaces the problem at the node instead of silently producing a narrower table. And remember what you're not getting: no row filtering here (that's Pandas Select Rows), no wildcards or regex - just an explicit list. When you need a tidy subset for the rest of your pipeline, this is the cheapest way to get it, and the narrower your table, the less work every downstream node does.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
dataframeDATAFRAME
column_namesSTRING

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME