Nodes/ComfyUI-Data-Analysis/Pandas Iloc Row Series
ComfyUI Node

Pandas Iloc Row Series

Pull one row out as a Series, by its position

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Iloc Row Series
  • dataframe
  • PDSERIES
row_integer_position0

PandasIlocRowSeries extracts a single row from a DataFrame and hands it back as a pandas Series - one row's worth of values with its column labels intact. If you've built a data pipeline in ComfyUI and need to isolate "that one row" to inspect, compare, or feed into a per-row calculation, this is the node.

It's part of HowToSD's ComfyUI-Data-Analysis pack, Hide Inada's wrapper set that puts pandas, matplotlib, and seaborn inside ComfyUI's node graph. No GPU, no models - just pandas nodes.

How it works

Under the hood it's one call: dataframe.iloc[row_integer_position]. The .iloc accessor selects by integer position - the physical row number, 0-based - which is exactly what "iloc" in the name is telling you. The author is careful about this distinction in the docs: in pandas, "index" means the unique label assigned to each row, whereas an integer position is what other software calls an index. So .iloc[0] always means "the first row in the table," even if that row's label is "safou" or a date.

The result is a PDSERIES - the pack's custom type for a pandas Series. It carries the column names as its index, so downstream nodes know what each value means. The original DataFrame is untouched.

The inputs that matter

  • dataframe - the source table.
  • row_integer_position - the row to grab, default 0. Remember it's 0-based: position 1 is the second row.

Output is a single PDSERIES. From there you can route it into whatever Series-aware nodes the pack offers (math, comparisons, display) or convert as needed.

Installing it

The same install for the whole pack. ComfyUI Manager: search "ComfyUI-Data-Analysis", install, restart. Manager installs pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, and lxml automatically. Manual route:

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 afterwards if you want the bundled example workflows to load. And the pack's license is custom non-commercial: personal and academic use is fine, commercial use needs written permission from the author.

Gotchas

Position vs. label is the recurring trap in this family. If you have a meaningful index (say, player names) and you want the row for a specific player, .iloc is the wrong tool - you'd want the loc-based row node that selects by label. This one is strictly "give me the Nth row." Out-of-range positions raise an IndexError and fail the run, so check your row count first. And note the output is a Series, not a DataFrame - if your downstream node expects a table, either keep it as a one-row selection via the rows/slice nodes or convert before wiring on.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
dataframeDATAFRAME
row_integer_positionINT00–2147483648

Outputs (1)

NameTypeDescription
PDSERIESPDSERIES