Added Pandas Set Index node

This commit is contained in:
HowToSD
2025-02-20 18:10:07 -08:00
parent 4dba94c46e
commit 373f52cacd
8 changed files with 112 additions and 1 deletions
+4
View File
@@ -52,6 +52,10 @@
| [Pandas Loc Row Series](pandas_loc_row_series.md) | Selects a row from a pandas DataFrame and output as a Series. |
| [Pandas Select Columns](pandas_select_columns.md) | Selects specific columns from a pandas DataFrame. |
| [Pandas Select Rows](pandas_select_rows.md) | Selects specific rows from a pandas DataFrame based on a condition. |
## Data transformation
| Node | Description |
| --- | --- |
| [Pandas Set Index](pandas_set_index.md) | Create index (row label) from existing column or columns. |
## Data type conversion
| Node | Description |
| --- | --- |
+33
View File
@@ -0,0 +1,33 @@
# Pandas Set Index
Create index (row label) from existing column or columns.
You can specify a single column or a comma-separated list of column labels in `column_names`.
If `drop=True`, the specified columns are removed from column labels and become the index.
If `drop=False`, the columns remain in the DataFrame column labels while also being used as the index.
If `append=True`, the new index is added alongside the existing index.
Below screenshots illustrate these options:
![Pandas Set Index](../images/set_index1.png)
![Pandas Set Index](../images/set_index2.png)
This class internally calls `pandas.DataFrame.set_index()`.
## Input
| Name | Data type |
|---|---|
| dataframe | DataFrame |
| column_names | String |
| drop | Boolean |
| append | Boolean |
## Output
| Data type |
|---|
| DataFrame |
<HR>
Category: Data transformation
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.