Replaced the occurrence of the words 'column index' with 'column label'.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 126 KiB |
+4
-4
@@ -33,7 +33,7 @@ You can right-click, select **Add Node**, go to **Data Analysis**, and look for
|
||||
| **Pandas Iloc Row Series** | Select a row by row integer position |
|
||||
| **Pandas Iloc Rows DataFrame** | Select rows by the list of row integer positions |
|
||||
| **Pandas Loc Row Series** | Select a row by row label (index) |
|
||||
| **Pandas Loc Cell Str** | Select a cell by row label (index) and column label (index) |
|
||||
| **Pandas Loc Cell Str** | Select a cell by row label (index) and column label |
|
||||
| **Pandas Head** | Extract the first few rows |
|
||||
|
||||
**Manipulating data**
|
||||
@@ -111,10 +111,10 @@ For **Pandas Iloc Row Series**, you only need to specify the row integer positi
|
||||

|
||||
|
||||
Note that in Pandas, integer position is an equivalent of an index in other software,
|
||||
while "index" means a unique label assigned to each row or column. See [pandas.DataFrame.iloc.html](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html).
|
||||
while "index" means a unique label assigned to each row. See [pandas.DataFrame.iloc.html](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html).
|
||||
|
||||
## Selecting a cell by row label (index) and column label (index)
|
||||
Use **Pandas Loc Cell Str** for selecting a cell by row label (index) and column label (index). Data type of the labels needs to be specified as shown below:
|
||||
## Selecting a cell by row label (index) and column label
|
||||
Use **Pandas Loc Cell Str** for selecting a cell by row label (index) and column label. Data type of the labels needs to be specified as shown below:
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"last_node_id":12,"last_link_id":8,"nodes":[{"id":8,"type":"PandasShowText","pos":[3.62848162651062,1602.7939453125],"size":[210,78.36762237548828],"flags":{},"order":6,"mode":0,"inputs":[{"name":"text","type":"STRING","link":5,"widget":{"name":"text"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowText"},"widgets_values":["","30"]},{"id":3,"type":"PandasCreateWithIndex","pos":[-607.1369018554688,1436.66015625],"size":[210,136.70285034179688],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"STRING","type":"STRING","links":[2,4],"slot_index":0}],"properties":{"Node name for S&R":"PandasCreateWithIndex"},"widgets_values":["index,A,B\nUS,1,10\nFrance,2,20\nGermany,3,30",0]},{"id":7,"type":"PandasLocCellStr","pos":[-294.200927734375,1601.82275390625],"size":[267.4131774902344,156.59359741210938],"flags":{},"order":3,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":4,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":[5],"slot_index":0}],"properties":{"Node name for S&R":"PandasLocCellStr"},"widgets_values":["","Germany","string","B","string"]},{"id":4,"type":"PandasShowDataFrame","pos":[-288.99395751953125,1434.0804443359375],"size":[210,116.62158966064453],"flags":{},"order":2,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":2,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[""," A B\nUS 1 10\nFrance 2 20\nGermany 3 30"]},{"id":10,"type":"PandasShowDataFrame","pos":[-293.0326232910156,1839.1920166015625],"size":[210,116.62158966064453],"flags":{},"order":4,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":7,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[""," A B\n0 1 100\n1 2 200\n2 3 300"]},{"id":9,"type":"PandasCreate","pos":[-610.7672119140625,1838.9556884765625],"size":[210,113.97640228271484],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"STRING","type":"STRING","links":[7,8],"slot_index":0}],"properties":{"Node name for S&R":"PandasCreate"},"widgets_values":["A,B\n1,100\n2,200\n3,300"]},{"id":12,"type":"PandasShowText","pos":[8.03433609008789,2006.485107421875],"size":[210,78.36762237548828],"flags":{},"order":7,"mode":0,"inputs":[{"name":"text","type":"STRING","link":6,"widget":{"name":"text"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowText"},"widgets_values":["","300"]},{"id":11,"type":"PandasLocCellStr","pos":[-291.8468933105469,2007.802734375],"size":[267.4131774902344,156.59359741210938],"flags":{},"order":5,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":8,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":[6],"slot_index":0}],"properties":{"Node name for S&R":"PandasLocCellStr"},"widgets_values":["","2","int","B","string"]}],"links":[[2,3,0,4,0,"STRING"],[4,3,0,7,0,"STRING"],[5,7,0,8,0,"STRING"],[6,11,0,12,0,"STRING"],[7,9,0,10,0,"STRING"],[8,9,0,11,0,"STRING"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.8639278591604531,"offset":[1001.9775968055815,-1355.3011187363343]},"node_versions":{"data-analysis":"265c91a0caf6a287657b6aa20bfd9ad97728bfe5"},"ue_links":[]},"version":0.4}
|
||||
{"last_node_id":12,"last_link_id":8,"nodes":[{"id":8,"type":"PandasShowText","pos":[3.62848162651062,1602.7939453125],"size":[210,78.36762237548828],"flags":{},"order":6,"mode":0,"inputs":[{"name":"text","type":"STRING","link":5,"widget":{"name":"text"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowText"},"widgets_values":["","30"]},{"id":3,"type":"PandasCreateWithIndex","pos":[-607.1369018554688,1436.66015625],"size":[210,136.70285034179688],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"STRING","type":"STRING","links":[2,4],"slot_index":0}],"properties":{"Node name for S&R":"PandasCreateWithIndex"},"widgets_values":["index,A,B\nUS,1,10\nFrance,2,20\nGermany,3,30",0]},{"id":4,"type":"PandasShowDataFrame","pos":[-288.99395751953125,1434.0804443359375],"size":[210,116.62158966064453],"flags":{},"order":2,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":2,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[""," A B\nUS 1 10\nFrance 2 20\nGermany 3 30"]},{"id":10,"type":"PandasShowDataFrame","pos":[-293.0326232910156,1839.1920166015625],"size":[210,116.62158966064453],"flags":{},"order":4,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":7,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[""," A B\n0 10 100\n1 20 200\n2 30 300"]},{"id":12,"type":"PandasShowText","pos":[8.03433609008789,2006.485107421875],"size":[210,78.36762237548828],"flags":{},"order":7,"mode":0,"inputs":[{"name":"text","type":"STRING","link":6,"widget":{"name":"text"}}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6}],"properties":{"Node name for S&R":"PandasShowText"},"widgets_values":["","30"]},{"id":11,"type":"PandasLocCellStr","pos":[-291.8468933105469,2007.802734375],"size":[267.4131774902344,156.59359741210938],"flags":{},"order":5,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":8,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":[6],"slot_index":0}],"properties":{"Node name for S&R":"PandasLocCellStr"},"widgets_values":["","2","int","A","string"]},{"id":7,"type":"PandasLocCellStr","pos":[-294.200927734375,1601.82275390625],"size":[267.4131774902344,156.59359741210938],"flags":{},"order":3,"mode":0,"inputs":[{"name":"dataframe_json","type":"STRING","link":4,"widget":{"name":"dataframe_json"}}],"outputs":[{"name":"STRING","type":"STRING","links":[5],"slot_index":0}],"properties":{"Node name for S&R":"PandasLocCellStr"},"widgets_values":["","Germany","string","B","string"]},{"id":9,"type":"PandasCreate","pos":[-610.7672119140625,1838.9556884765625],"size":[210,113.97640228271484],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"STRING","type":"STRING","links":[7,8],"slot_index":0}],"properties":{"Node name for S&R":"PandasCreate"},"widgets_values":["A,B\n10,100\n20,200\n30,300"]}],"links":[[2,3,0,4,0,"STRING"],[4,3,0,7,0,"STRING"],[5,7,0,8,0,"STRING"],[6,11,0,12,0,"STRING"],[7,9,0,10,0,"STRING"],[8,9,0,11,0,"STRING"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.863927859160454,"offset":[1091.6818551119054,-1331.0653891577363]},"node_versions":{"data-analysis":"d484a368b2c6ce687911c30d1325c680758e7a24"},"ue_links":[]},"version":0.4}
|
||||
@@ -8,7 +8,7 @@ class PandasIlocRowSeries:
|
||||
PandasLocRowSeries:
|
||||
A class for selecting a row from a pandas DataFrame and returning it as a Series.
|
||||
The row is specified by its integer position, similar to an index in other software.
|
||||
Note: In Pandas, "index" refers to a unique label assigned to each row or column. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html
|
||||
Note: In Pandas, "index" refers to a unique label assigned to each row. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -21,8 +21,8 @@ class PandasLocCellStr:
|
||||
"dataframe_json": ("STRING", {"multiline": True}),
|
||||
"row_index": ("STRING", {"default": ""}),
|
||||
"row_index_type":(("string", "int"),),
|
||||
"column_index": ("STRING", {"default": ""}),
|
||||
"column_index_type":(("string", "int"),)
|
||||
"column_label": ("STRING", {"default": ""}),
|
||||
"column_label_type":(("string", "int"),)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ class PandasLocCellStr:
|
||||
def cell(self, dataframe_json: str,
|
||||
row_index: str,
|
||||
row_index_type: str,
|
||||
column_index: str,
|
||||
column_index_type: str) -> tuple:
|
||||
column_label: str,
|
||||
column_label_type: str) -> tuple:
|
||||
"""
|
||||
Selects specific cell from a pandas DataFrame.
|
||||
|
||||
@@ -42,8 +42,8 @@ class PandasLocCellStr:
|
||||
dataframe_json (str): A JSON string representation of the DataFrame.
|
||||
row_index (str): The row index (row label) for the cell.
|
||||
row_index_type (str): The data type of the row index.
|
||||
column_index (str): The column index (row label) for the cell.
|
||||
column_index_type (str): The data type of the column index.
|
||||
column_label (str): The column label for the cell.
|
||||
column_label_type (str): The data type of the column label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing the value of the cell in string.
|
||||
@@ -51,7 +51,7 @@ class PandasLocCellStr:
|
||||
# Deserialize JSON string to DataFrame
|
||||
df = pd.read_json(StringIO(dataframe_json))
|
||||
row_index = int(row_index) if row_index_type == "int" else row_index
|
||||
column_index = int(column_index) if column_index_type == "int" else column_index
|
||||
column_label = int(column_label) if column_label_type == "int" else column_label
|
||||
|
||||
value = df.loc[row_index, column_index]
|
||||
value = df.loc[row_index, column_label]
|
||||
return (str(value),)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "data-analysis"
|
||||
description = "Data analysis custom modules for ComfyUI - Use Pandas & Matplotlib within ComfyUI"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
license = {file = "LICENSE"}
|
||||
|
||||
[project.urls]
|
||||
|
||||
Reference in New Issue
Block a user