diff --git a/README.md b/README.md index bc894b1..cc5cc05 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Note: GPU is not required to run this custom module. This custom node module requires pandas and matplotlib, which are not included in the default ComfyUI installation. If you install this module using ComfyUI Manager, these packages should be installed automatically. However, if installation fails, refer to the pandas and matplotlib documentation for manual installation. ## How to Use -Refer to [User's Guide](docs/ug.md) +Refer to [User's Guide](docs/ug.md) or check out [Node Reference](reference/node_reference.md) For a practical example, see the tutorial on baseball data: [How to Find Out Who Had the Most Hits](docs/baseball_example1.md). diff --git a/__init__.py b/__init__.py index 7c0423a..5969db3 100644 --- a/__init__.py +++ b/__init__.py @@ -15,6 +15,11 @@ from .modules.pandas_wrapper.pandas_create_with_index import PandasCreateWithInd from .modules.pandas_wrapper.pandas_div import PandasDiv from .modules.pandas_wrapper.pandas_div_series import PandasDivSeries from .modules.pandas_wrapper.pandas_dropna import PandasDropNA +from .modules.pandas_wrapper.pandas_exp import PandasExp +from .modules.pandas_wrapper.pandas_log import PandasLog +from .modules.pandas_wrapper.pandas_sin import PandasSin +from .modules.pandas_wrapper.pandas_cos import PandasCos +from .modules.pandas_wrapper.pandas_tan import PandasTan from .modules.pandas_wrapper.pandas_group_by import PandasGroupBy from .modules.pandas_wrapper.pandas_head import PandasHead from .modules.pandas_wrapper.pandas_horizontal_concat import PandasHorizontalConcat @@ -78,6 +83,11 @@ NODE_CLASS_MAPPINGS: Dict[str, Type[T]] = { "PandasDiv": PandasDiv, "PandasDivSeries": PandasDivSeries, "PandasDropNA": PandasDropNA, + "PandasExp": PandasExp, + "PandasLog": PandasLog, + "PandasSin": PandasSin, + "PandasCos": PandasCos, + "PandasTan": PandasTan, "PandasGroupBy": PandasGroupBy, "PandasHead": PandasHead, "PandasHorizontalConcat": PandasHorizontalConcat, @@ -143,6 +153,11 @@ NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = { "PandasDiv": "Pandas Div", "PandasDivSeries": "Pandas Div Series", "PandasDropNA": "Pandas Drop NA", + "PandasExp": "Pandas Exp", + "PandasLog": "Pandas Log", + "PandasSin": "Pandas Sin", + "PandasCos": "Pandas Cos", + "PandasTan": "Pandas Tan", "PandasGroupBy": "Pandas Group By", "PandasHead": "Pandas Head", "PandasHorizontalConcat": "Pandas Horizontal Concat", diff --git a/dev/scripts/reference_generate.py b/dev/scripts/reference_generate.py new file mode 100644 index 0000000..134db7e --- /dev/null +++ b/dev/scripts/reference_generate.py @@ -0,0 +1,159 @@ +""" +Generate node reference documents. + +Run this at the project root if you update a docstring of the node source file. + +To skip the python file from included in the reference, put +``` +pragma: skip_doc +``` +in the docstring for the class. + +To use a custom node name, put the node name on the first line of the docstring for the class with ":". +e.g. +``` + CDA JSON Create: + Creates a serialized JSON object using values entered in the text field. +``` +""" +import os +import re +import ast +from collections import defaultdict +from typing import Dict, List + +# Mapping for data type conversion +data_type_mapping = { + "DATAFRAME": "DataFrame", + "PDSERIES": "Series", + "PDINDEX": "Index" +} + +def convert_data_type(data_type: str) -> str: + """Convert type to the required format.""" + if data_type in data_type_mapping: + return data_type_mapping[data_type] + return data_type.lower().capitalize() + +def extract_class_info(class_def: ast.ClassDef) -> Dict[str, str]: + """Extract class name, title, category, and docstring.""" + class_name = class_def.name + docstring = ast.get_docstring(class_def) or "" + + if "pragma: skip_doc" in docstring: + return None + + lines = docstring.split("\n") + + title = None + category = "Miscellaneous" + + if len(lines) > 1 and lines[0].strip().endswith(":") and lines[0].strip()[0].isupper(): + title = lines.pop(0).strip().rstrip(":") + + if not title: + title = "# " + " ".join(re.findall(r'[A-Z][a-z]*', class_name)) + else: + title = f"# {title}" + + description_lines = [] + for line in lines: + if line.strip().startswith("category:"): + category = line.split(":", 1)[-1].strip() + else: + description_lines.append(line) + + description = "\n".join(description_lines).strip() + + return {"title": title, "description": description, "class_name": class_name, "first_sentence": description_lines[0] if description_lines else "", "category": category} + +def extract_input_types(class_def: ast.ClassDef) -> str: + """Extract INPUT_TYPES definition.""" + input_table = "" + for node in class_def.body: + if isinstance(node, ast.FunctionDef) and node.name == "INPUT_TYPES": + for stmt in ast.walk(node): + if isinstance(stmt, ast.Dict): + for key, value in zip(stmt.keys, stmt.values): + if isinstance(key, ast.Constant) and isinstance(value, ast.Tuple) and len(value.elts) > 0: + param_name = key.value + data_type = value.elts[0].value if isinstance(value.elts[0], ast.Constant) else "" + input_table += f"| {param_name} | {convert_data_type(data_type)} |\n" + return "## Input\n| Name | Data type |\n|---|---|\n" + input_table if input_table else "" + +def extract_return_types(class_def: ast.ClassDef) -> str: + """Extract RETURN_TYPES value.""" + for node in class_def.body: + # Look for assignment or annotated assignment (type hint) statement. + # Node target is the RHS. + if ( + isinstance(node, ast.Assign) and + any(target.id == "RETURN_TYPES" for target in node.targets if isinstance(target, ast.Name)) + ) or ( + isinstance(node, ast.AnnAssign) and + isinstance(node.target, ast.Name) and + node.target.id == "RETURN_TYPES" + ): + if isinstance(node.value, ast.Tuple): + return_types = [convert_data_type(elt.value) for elt in node.value.elts if isinstance(elt, ast.Constant)] + return "## Output\n| Data type |\n|---|\n" + "".join(f"| {rtype} |\n" for rtype in return_types) + return "" + +def process_python_file(file_path: str, output_dir: str, node_list: Dict[str, List[str]]): + """Process a single Python file and generate corresponding Markdown.""" + with open(file_path, "r", encoding="utf-8") as f: + tree = ast.parse(f.read(), filename=file_path) + + for node in tree.body: + if isinstance(node, ast.ClassDef): + class_info = extract_class_info(node) + if not class_info: + return + + input_section = extract_input_types(node) + output_section = extract_return_types(node) + category = class_info["category"] + + file_name = os.path.splitext(os.path.basename(file_path))[0] + ".md" + output_path = os.path.join(output_dir, file_name) + + with open(output_path, "w", encoding="utf-8") as md_file: + md_file.write(f"{class_info['title']}\n{class_info['description']}\n\n") + if input_section: + md_file.write(input_section + "\n") + if output_section: + md_file.write(output_section + "\n") + md_file.write("
\n") + md_file.write(f"Category: {category}\n\n") + md_file.write(f"ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.\n") + + node_list[category].append((class_info['title'][2:], file_name, class_info['first_sentence'])) + +def generate_node_list(output_dir: str, node_list: Dict[str, List[str]]): + """Generate node_reference.md file.""" + node_list_path = os.path.join(output_dir, "node_reference.md") + with open(node_list_path, "w", encoding="utf-8") as md_file: + md_file.write("# Node Reference\n") + for category in sorted(node_list.keys()): + md_file.write(f"## {category}\n| Node | Description |\n| --- | --- |\n") + for title, file_name, description in sorted(node_list[category]): + md_file.write(f"| [{title}]({file_name}) | {description} |\n") + +def main(): + """Main function to process all Python files under modules/**.py.""" + source_dir = "modules" + output_dir = "docs/reference" + os.makedirs(output_dir, exist_ok=True) + + node_list = defaultdict(list) + + for root, _, files in os.walk(source_dir): + for file in files: + if file.endswith(".py"): + file_path = os.path.join(root, file) + process_python_file(file_path, output_dir, node_list) + + generate_node_list(output_dir, node_list) + +if __name__ == "__main__": + main() diff --git a/docs/reference/cda_json_create.md b/docs/reference/cda_json_create.md new file mode 100644 index 0000000..0d57537 --- /dev/null +++ b/docs/reference/cda_json_create.md @@ -0,0 +1,17 @@ +# CDA JSON Create +Creates a serialized JSON object using values entered in the text field. + +## Input +| Name | Data type | +|---|---| +| data | String | + +## Output +| Data type | +|---| +| String | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/mpl_bar.md b/docs/reference/mpl_bar.md new file mode 100644 index 0000000..30282f8 --- /dev/null +++ b/docs/reference/mpl_bar.md @@ -0,0 +1,12 @@ +# MPL Bar Chart +Generates a bar chart from a Pandas DataFrame. + +## Output +| Data type | +|---| +| Image | + +
+Category: Plot + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/mpl_line.md b/docs/reference/mpl_line.md new file mode 100644 index 0000000..e32e551 --- /dev/null +++ b/docs/reference/mpl_line.md @@ -0,0 +1,12 @@ +# MPL Line Plot +Generates a line plot from a pandas DataFrame. + +## Output +| Data type | +|---| +| Image | + +
+Category: Plot + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/mpl_scatter.md b/docs/reference/mpl_scatter.md new file mode 100644 index 0000000..0196ed1 --- /dev/null +++ b/docs/reference/mpl_scatter.md @@ -0,0 +1,12 @@ +# MPL Scatter Plot +Generates a scatter plot from a pandas DataFrame. + +## Output +| Data type | +|---| +| Image | + +
+Category: Plot + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/node_reference.md b/docs/reference/node_reference.md new file mode 100644 index 0000000..9956cc6 --- /dev/null +++ b/docs/reference/node_reference.md @@ -0,0 +1,100 @@ +# Node Reference +## Aggregation +| Node | Description | +| --- | --- | +| [Pandas Group By](pandas_group_by.md) | Computes aggregate values for groups in a DataFrame. | +## Arithmetic method +| Node | Description | +| --- | --- | +| [Pandas Add](pandas_add.md) | Adds two pandas DataFrames. | +| [Pandas Add Series](pandas_add_series.md) | Adds a Pandas Series to a pandas DataFrames. | +| [Pandas Div](pandas_div.md) | Divides two pandas DataFrames. | +| [Pandas Div Series](pandas_div_series.md) | Divides a Pandas DataFrame by a Pandas Series. | +| [Pandas Mul](pandas_mul.md) | Multiplies two pandas DataFrames. | +| [Pandas Mul Series](pandas_mul_series.md) | Multiplies a Pandas DataFrame by a Pandas Series. | +| [Pandas Pow](pandas_pow.md) | Exponentiates two pandas DataFrames. | +| [Pandas Pow Series](pandas_pow_series.md) | Raises a Pandas DataFrame to the power of a Pandas Series. | +| [Pandas Sub](pandas_sub.md) | Subtracts a Pandas DataFrame from another DataFrame. | +| [Pandas Sub Series](pandas_sub_series.md) | Subtracts a Pandas Series from a Pandas DataFrame. | +## Data cleansing +| Node | Description | +| --- | --- | +| [Pandas Drop NA](pandas_dropna.md) | Drops missing values from a pandas DataFrame. | +| [Pandas Is NA](pandas_isna.md) | Checks a pandas DataFrame for missing values. | +## Data subset selection +| Node | Description | +| --- | --- | +| [Pandas Head](pandas_head.md) | Retrieves the first few rows of a pandas DataFrame. | +| [Pandas Iloc Row Series](pandas_iloc_row_series.md) | Selects a row from a pandas DataFrame and returning it as a Series. | +| [Pandas Iloc Rows Data Frame](pandas_iloc_rows_dataframe.md) | Selects rows from a pandas DataFrame and returning it as a DataFrame. | +| [Pandas Loc Cell Str](pandas_loc_cell_str.md) | Selects a cell from a pandas DataFrame and output as a string. | +| [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 type conversion +| Node | Description | +| --- | --- | +| [Pandas As Float](pandas_as_float.md) | Converts all cells in a pandas DataFrame to float type. | +| [Pandas As Int](pandas_as_int.md) | Converts all cells in a pandas DataFrame to integer type. | +| [Pandas As String](pandas_as_string.md) | Converts all cells in a pandas DataFrame to string type. | +## DataFrame information +| Node | Description | +| --- | --- | +| [Pandas Columns](pandas_columns.md) | Retrieves the column labels of a pandas DataFrame. | +| [Pandas Index](pandas_index.md) | Retrieves the row labels (index) of a pandas DataFrame. | +## Display data +| Node | Description | +| --- | --- | +| [Pandas Index To String](pandas_index_to_string.md) | Converts a pandas Index to a string representation. | +| [Pandas Series To String](pandas_series_to_string.md) | Converts a pandas Series to a string representation. | +| [Pandas Show Data Frame](pandas_show_dataframe.md) | Displays a Pandas DataFrame as text. | +| [Pandas Show Index](pandas_show_index.md) | Displays a Pandas Index as text. | +| [Pandas Show Series](pandas_show_series.md) | Displays a Pandas Series as text. | +| [Pandas Show Text](pandas_show_text.md) | Displays a string. | +| [Pandas To String](pandas_to_string.md) | Converts a pandas DataFrame to a string representation. | +## IO +| Node | Description | +| --- | --- | +| [CDA JSON Create](cda_json_create.md) | Creates a serialized JSON object using values entered in the text field. | +| [Pandas Create](pandas_create.md) | Creates a pandas DataFrame using values entered in the text field. | +| [Pandas Create With Index](pandas_create_with_index.md) | Creates a pandas DataFrame using values entered in the text field. Input data is assumed to have an index. | +| [Pandas Load CSV](pandas_load_csv.md) | Loads CSV files into a pandas DataFrame. | +| [Pandas Load CSV With Encoding](pandas_load_csv_with_encoding.md) | Loads CSV files into a pandas DataFrame. | +| [Pandas Load CSV With Index](pandas_load_csv_with_index.md) | Loads CSV files into a pandas DataFrame. | +| [Pandas Load JSON](pandas_load_json.md) | Loads JSON files into a pandas DataFrame. | +| [Pandas Save CSV](pandas_save_csv.md) | Saves a PandasDataFrame to a CSV file. | +| [Pandas Save JSON](pandas_save_json.md) | Saves a PandasDataFrame to a JSON file. | +## Math +| Node | Description | +| --- | --- | +| [Pandas Cos](pandas_cos.md) | Apply the cosine function to a pandas DataFrame and converting non-numeric values to NaN. | +| [Pandas Exp](pandas_exp.md) | Apply the exponential function to a pandas DataFrame and converting non-numeric values to NaN. | +| [Pandas Log](pandas_log.md) | Applying the natural logarithm function to a pandas DataFrame and converting non-numeric values to NaN. | +| [Pandas Sin](pandas_sin.md) | Applies the sine function to a pandas DataFrame and converting non-numeric values to NaN. | +| [Pandas Tan](pandas_tan.md) | Applies the tangent function to a pandas DataFrame and converting non-numeric values to NaN. | +## Plot +| Node | Description | +| --- | --- | +| [MPL Bar Chart](mpl_bar.md) | Generates a bar chart from a Pandas DataFrame. | +| [MPL Line Plot](mpl_line.md) | Generates a line plot from a pandas DataFrame. | +| [MPL Scatter Plot](mpl_scatter.md) | Generates a scatter plot from a pandas DataFrame. | +## Summary statistics +| Node | Description | +| --- | --- | +| [Pandas Count](pandas_count.md) | Computes the count of a pandas DataFrame. | +| [Pandas Max](pandas_max.md) | Computes the max of a pandas DataFrame. | +| [Pandas Mean](pandas_mean.md) | Computes the mean of a pandas DataFrame. | +| [Pandas Median](pandas_median.md) | Computes the median of a pandas DataFrame. | +| [Pandas Min](pandas_min.md) | Computes the min of a pandas DataFrame. | +| [Pandas Mode](pandas_mode.md) | Computes the mode of a pandas DataFrame. | +| [Pandas Std](pandas_std.md) | Computes the standard deviation of a pandas DataFrame. | +| [Pandas Sum](pandas_sum.md) | Computes the sum of a pandas DataFrame. | +| [Pandas Summary](pandas_summary.md) | Analyzes and summarizes a pandas DataFrame. | +| [Pandas Var](pandas_var.md) | Computes the variance of a pandas DataFrame. | +## Transformation +| Node | Description | +| --- | --- | +| [Pandas Horizontal Concat](pandas_horizontal_concat.md) | Horizontally concatenates two pandas DataFrames. | +| [Pandas Join](pandas_join.md) | Merges two pandas DataFrames based on a common column. | +| [Pandas Sort](pandas_sort.md) | Sorts a pandas DataFrame by a specified column. | +| [Pandas Vertical Concat](pandas_vertical_concat.md) | Vertically concatenates two pandas DataFrames. | diff --git a/docs/reference/pandas_add.md b/docs/reference/pandas_add.md new file mode 100644 index 0000000..49680e7 --- /dev/null +++ b/docs/reference/pandas_add.md @@ -0,0 +1,18 @@ +# Pandas Add +Adds two pandas DataFrames. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_add_series.md b/docs/reference/pandas_add_series.md new file mode 100644 index 0000000..b9a1ff2 --- /dev/null +++ b/docs/reference/pandas_add_series.md @@ -0,0 +1,18 @@ +# Pandas Add Series +Adds a Pandas Series to a pandas DataFrames. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_series | Series | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_as_float.md b/docs/reference/pandas_as_float.md new file mode 100644 index 0000000..6b54f05 --- /dev/null +++ b/docs/reference/pandas_as_float.md @@ -0,0 +1,17 @@ +# Pandas As Float +Converts all cells in a pandas DataFrame to float type. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data type conversion + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_as_int.md b/docs/reference/pandas_as_int.md new file mode 100644 index 0000000..46ccd00 --- /dev/null +++ b/docs/reference/pandas_as_int.md @@ -0,0 +1,17 @@ +# Pandas As Int +Converts all cells in a pandas DataFrame to integer type. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data type conversion + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_as_string.md b/docs/reference/pandas_as_string.md new file mode 100644 index 0000000..2c012ac --- /dev/null +++ b/docs/reference/pandas_as_string.md @@ -0,0 +1,17 @@ +# Pandas As String +Converts all cells in a pandas DataFrame to string type. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data type conversion + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_columns.md b/docs/reference/pandas_columns.md new file mode 100644 index 0000000..bbad5dc --- /dev/null +++ b/docs/reference/pandas_columns.md @@ -0,0 +1,17 @@ +# Pandas Columns +Retrieves the column labels of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Index | + +
+Category: DataFrame information + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_cos.md b/docs/reference/pandas_cos.md new file mode 100644 index 0000000..5b2e2d2 --- /dev/null +++ b/docs/reference/pandas_cos.md @@ -0,0 +1,17 @@ +# Pandas Cos +Apply the cosine function to a pandas DataFrame and converting non-numeric values to NaN. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Math + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_count.md b/docs/reference/pandas_count.md new file mode 100644 index 0000000..c59e31e --- /dev/null +++ b/docs/reference/pandas_count.md @@ -0,0 +1,17 @@ +# Pandas Count +Computes the count of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_create.md b/docs/reference/pandas_create.md new file mode 100644 index 0000000..d9964ed --- /dev/null +++ b/docs/reference/pandas_create.md @@ -0,0 +1,17 @@ +# Pandas Create +Creates a pandas DataFrame using values entered in the text field. + +## Input +| Name | Data type | +|---|---| +| data | String | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_create_with_index.md b/docs/reference/pandas_create_with_index.md new file mode 100644 index 0000000..07d4f25 --- /dev/null +++ b/docs/reference/pandas_create_with_index.md @@ -0,0 +1,18 @@ +# Pandas Create With Index +Creates a pandas DataFrame using values entered in the text field. Input data is assumed to have an index. + +## Input +| Name | Data type | +|---|---| +| data | String | +| index_col | Int | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_div.md b/docs/reference/pandas_div.md new file mode 100644 index 0000000..9655bff --- /dev/null +++ b/docs/reference/pandas_div.md @@ -0,0 +1,18 @@ +# Pandas Div +Divides two pandas DataFrames. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_div_series.md b/docs/reference/pandas_div_series.md new file mode 100644 index 0000000..00fcd67 --- /dev/null +++ b/docs/reference/pandas_div_series.md @@ -0,0 +1,18 @@ +# Pandas Div Series +Divides a Pandas DataFrame by a Pandas Series. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_series | Series | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_dropna.md b/docs/reference/pandas_dropna.md new file mode 100644 index 0000000..5a3d1f9 --- /dev/null +++ b/docs/reference/pandas_dropna.md @@ -0,0 +1,17 @@ +# Pandas Drop NA +Drops missing values from a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data cleansing + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_exp.md b/docs/reference/pandas_exp.md new file mode 100644 index 0000000..88e9c69 --- /dev/null +++ b/docs/reference/pandas_exp.md @@ -0,0 +1,17 @@ +# Pandas Exp +Apply the exponential function to a pandas DataFrame and converting non-numeric values to NaN. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Math + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_group_by.md b/docs/reference/pandas_group_by.md new file mode 100644 index 0000000..8dc30d9 --- /dev/null +++ b/docs/reference/pandas_group_by.md @@ -0,0 +1,19 @@ +# Pandas Group By +Computes aggregate values for groups in a DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| column_name | String | +| aggragate_function | | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Aggregation + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_head.md b/docs/reference/pandas_head.md new file mode 100644 index 0000000..2b85f6e --- /dev/null +++ b/docs/reference/pandas_head.md @@ -0,0 +1,18 @@ +# Pandas Head +Retrieves the first few rows of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| rows | Int | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data subset selection + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_horizontal_concat.md b/docs/reference/pandas_horizontal_concat.md new file mode 100644 index 0000000..1cb4276 --- /dev/null +++ b/docs/reference/pandas_horizontal_concat.md @@ -0,0 +1,18 @@ +# Pandas Horizontal Concat +Horizontally concatenates two pandas DataFrames. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Transformation + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_iloc_row_series.md b/docs/reference/pandas_iloc_row_series.md new file mode 100644 index 0000000..f349e04 --- /dev/null +++ b/docs/reference/pandas_iloc_row_series.md @@ -0,0 +1,20 @@ +# Pandas Iloc Row Series +Selects 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. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| row_integer_position | Int | + +## Output +| Data type | +|---| +| Series | + +
+Category: Data subset selection + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_iloc_rows_dataframe.md b/docs/reference/pandas_iloc_rows_dataframe.md new file mode 100644 index 0000000..ec1e269 --- /dev/null +++ b/docs/reference/pandas_iloc_rows_dataframe.md @@ -0,0 +1,19 @@ +# Pandas Iloc Rows Data Frame +Selects rows from a pandas DataFrame and returning it as a DataFrame. +Rows are specified by the list of integer positions. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| row_int_pos_list_json | String | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data subset selection + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_index.md b/docs/reference/pandas_index.md new file mode 100644 index 0000000..070cdb8 --- /dev/null +++ b/docs/reference/pandas_index.md @@ -0,0 +1,17 @@ +# Pandas Index +Retrieves the row labels (index) of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Index | + +
+Category: DataFrame information + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_index_to_string.md b/docs/reference/pandas_index_to_string.md new file mode 100644 index 0000000..70887ec --- /dev/null +++ b/docs/reference/pandas_index_to_string.md @@ -0,0 +1,17 @@ +# Pandas Index To String +Converts a pandas Index to a string representation. + +## Input +| Name | Data type | +|---|---| +| index | Index | + +## Output +| Data type | +|---| +| String | + +
+Category: Display data + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_isna.md b/docs/reference/pandas_isna.md new file mode 100644 index 0000000..1550041 --- /dev/null +++ b/docs/reference/pandas_isna.md @@ -0,0 +1,17 @@ +# Pandas Is NA +Checks a pandas DataFrame for missing values. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data cleansing + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_join.md b/docs/reference/pandas_join.md new file mode 100644 index 0000000..dc12eb0 --- /dev/null +++ b/docs/reference/pandas_join.md @@ -0,0 +1,20 @@ +# Pandas Join +Merges two pandas DataFrames based on a common column. + +## Input +| Name | Data type | +|---|---| +| left_dataframe | DataFrame | +| right_dataframe | DataFrame | +| on_column_name | String | +| join_method | | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Transformation + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_load_csv.md b/docs/reference/pandas_load_csv.md new file mode 100644 index 0000000..f40d488 --- /dev/null +++ b/docs/reference/pandas_load_csv.md @@ -0,0 +1,17 @@ +# Pandas Load CSV +Loads CSV files into a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| file_path | String | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_load_csv_with_encoding.md b/docs/reference/pandas_load_csv_with_encoding.md new file mode 100644 index 0000000..0a03922 --- /dev/null +++ b/docs/reference/pandas_load_csv_with_encoding.md @@ -0,0 +1,18 @@ +# Pandas Load CSV With Encoding +Loads CSV files into a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| file_path | String | +| encoding | String | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_load_csv_with_index.md b/docs/reference/pandas_load_csv_with_index.md new file mode 100644 index 0000000..21eb090 --- /dev/null +++ b/docs/reference/pandas_load_csv_with_index.md @@ -0,0 +1,19 @@ +# Pandas Load CSV With Index +Loads CSV files into a pandas DataFrame. +Input data is assume to have an index. + +## Input +| Name | Data type | +|---|---| +| file_path | String | +| index_col | Int | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_load_json.md b/docs/reference/pandas_load_json.md new file mode 100644 index 0000000..d0c6e7e --- /dev/null +++ b/docs/reference/pandas_load_json.md @@ -0,0 +1,17 @@ +# Pandas Load JSON +Loads JSON files into a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| file_path | String | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_loc_cell_str.md b/docs/reference/pandas_loc_cell_str.md new file mode 100644 index 0000000..803d4f3 --- /dev/null +++ b/docs/reference/pandas_loc_cell_str.md @@ -0,0 +1,21 @@ +# Pandas Loc Cell Str +Selects a cell from a pandas DataFrame and output as a string. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| row_index | String | +| row_index_type | | +| column_label | String | +| column_label_type | | + +## Output +| Data type | +|---| +| String | + +
+Category: Data subset selection + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_loc_row_series.md b/docs/reference/pandas_loc_row_series.md new file mode 100644 index 0000000..44353fa --- /dev/null +++ b/docs/reference/pandas_loc_row_series.md @@ -0,0 +1,19 @@ +# Pandas Loc Row Series +Selects a row from a pandas DataFrame and output as a Series. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| row_index | String | +| row_index_type | | + +## Output +| Data type | +|---| +| Series | + +
+Category: Data subset selection + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_log.md b/docs/reference/pandas_log.md new file mode 100644 index 0000000..54a8782 --- /dev/null +++ b/docs/reference/pandas_log.md @@ -0,0 +1,17 @@ +# Pandas Log +Applying the natural logarithm function to a pandas DataFrame and converting non-numeric values to NaN. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Math + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_max.md b/docs/reference/pandas_max.md new file mode 100644 index 0000000..d10094e --- /dev/null +++ b/docs/reference/pandas_max.md @@ -0,0 +1,17 @@ +# Pandas Max +Computes the max of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_mean.md b/docs/reference/pandas_mean.md new file mode 100644 index 0000000..2942a82 --- /dev/null +++ b/docs/reference/pandas_mean.md @@ -0,0 +1,17 @@ +# Pandas Mean +Computes the mean of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_median.md b/docs/reference/pandas_median.md new file mode 100644 index 0000000..a085feb --- /dev/null +++ b/docs/reference/pandas_median.md @@ -0,0 +1,17 @@ +# Pandas Median +Computes the median of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_min.md b/docs/reference/pandas_min.md new file mode 100644 index 0000000..55a12e3 --- /dev/null +++ b/docs/reference/pandas_min.md @@ -0,0 +1,17 @@ +# Pandas Min +Computes the min of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_mode.md b/docs/reference/pandas_mode.md new file mode 100644 index 0000000..02c1098 --- /dev/null +++ b/docs/reference/pandas_mode.md @@ -0,0 +1,17 @@ +# Pandas Mode +Computes the mode of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_mul.md b/docs/reference/pandas_mul.md new file mode 100644 index 0000000..8c59afe --- /dev/null +++ b/docs/reference/pandas_mul.md @@ -0,0 +1,18 @@ +# Pandas Mul +Multiplies two pandas DataFrames. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_mul_series.md b/docs/reference/pandas_mul_series.md new file mode 100644 index 0000000..e3f3a61 --- /dev/null +++ b/docs/reference/pandas_mul_series.md @@ -0,0 +1,18 @@ +# Pandas Mul Series +Multiplies a Pandas DataFrame by a Pandas Series. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_series | Series | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_pow.md b/docs/reference/pandas_pow.md new file mode 100644 index 0000000..6ff11c7 --- /dev/null +++ b/docs/reference/pandas_pow.md @@ -0,0 +1,18 @@ +# Pandas Pow +Exponentiates two pandas DataFrames. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_pow_series.md b/docs/reference/pandas_pow_series.md new file mode 100644 index 0000000..9a591fa --- /dev/null +++ b/docs/reference/pandas_pow_series.md @@ -0,0 +1,18 @@ +# Pandas Pow Series +Raises a Pandas DataFrame to the power of a Pandas Series. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_series | Series | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_save_csv.md b/docs/reference/pandas_save_csv.md new file mode 100644 index 0000000..6da3303 --- /dev/null +++ b/docs/reference/pandas_save_csv.md @@ -0,0 +1,18 @@ +# Pandas Save CSV +Saves a PandasDataFrame to a CSV file. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| file_path | String | + +## Output +| Data type | +|---| +| String | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_save_json.md b/docs/reference/pandas_save_json.md new file mode 100644 index 0000000..db2242f --- /dev/null +++ b/docs/reference/pandas_save_json.md @@ -0,0 +1,18 @@ +# Pandas Save JSON +Saves a PandasDataFrame to a JSON file. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| file_path | String | + +## Output +| Data type | +|---| +| String | + +
+Category: IO + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_select_columns.md b/docs/reference/pandas_select_columns.md new file mode 100644 index 0000000..76ac8c6 --- /dev/null +++ b/docs/reference/pandas_select_columns.md @@ -0,0 +1,18 @@ +# Pandas Select Columns +Selects specific columns from a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| column_names | String | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data subset selection + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_select_rows.md b/docs/reference/pandas_select_rows.md new file mode 100644 index 0000000..b35f471 --- /dev/null +++ b/docs/reference/pandas_select_rows.md @@ -0,0 +1,18 @@ +# Pandas Select Rows +Selects specific rows from a pandas DataFrame based on a condition. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| condition | String | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Data subset selection + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_series_to_string.md b/docs/reference/pandas_series_to_string.md new file mode 100644 index 0000000..c5ea7cc --- /dev/null +++ b/docs/reference/pandas_series_to_string.md @@ -0,0 +1,17 @@ +# Pandas Series To String +Converts a pandas Series to a string representation. + +## Input +| Name | Data type | +|---|---| +| series | Series | + +## Output +| Data type | +|---| +| String | + +
+Category: Display data + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_show_dataframe.md b/docs/reference/pandas_show_dataframe.md new file mode 100644 index 0000000..4968ee7 --- /dev/null +++ b/docs/reference/pandas_show_dataframe.md @@ -0,0 +1,17 @@ +# Pandas Show Data Frame +Displays a Pandas DataFrame as text. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| String | + +
+Category: Display data + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_show_index.md b/docs/reference/pandas_show_index.md new file mode 100644 index 0000000..5887bbb --- /dev/null +++ b/docs/reference/pandas_show_index.md @@ -0,0 +1,17 @@ +# Pandas Show Index +Displays a Pandas Index as text. + +## Input +| Name | Data type | +|---|---| +| index_list | Index | + +## Output +| Data type | +|---| +| String | + +
+Category: Display data + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_show_series.md b/docs/reference/pandas_show_series.md new file mode 100644 index 0000000..72ad8b8 --- /dev/null +++ b/docs/reference/pandas_show_series.md @@ -0,0 +1,17 @@ +# Pandas Show Series +Displays a Pandas Series as text. + +## Input +| Name | Data type | +|---|---| +| series_list | Series | + +## Output +| Data type | +|---| +| String | + +
+Category: Display data + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_show_text.md b/docs/reference/pandas_show_text.md new file mode 100644 index 0000000..de4cc85 --- /dev/null +++ b/docs/reference/pandas_show_text.md @@ -0,0 +1,17 @@ +# Pandas Show Text +Displays a string. + +## Input +| Name | Data type | +|---|---| +| text | String | + +## Output +| Data type | +|---| +| String | + +
+Category: Display data + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_sin.md b/docs/reference/pandas_sin.md new file mode 100644 index 0000000..d91afcb --- /dev/null +++ b/docs/reference/pandas_sin.md @@ -0,0 +1,17 @@ +# Pandas Sin +Applies the sine function to a pandas DataFrame and converting non-numeric values to NaN. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Math + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_sort.md b/docs/reference/pandas_sort.md new file mode 100644 index 0000000..61966d7 --- /dev/null +++ b/docs/reference/pandas_sort.md @@ -0,0 +1,19 @@ +# Pandas Sort +Sorts a pandas DataFrame by a specified column. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | +| column_name | String | +| ascending | Boolean | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Transformation + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_std.md b/docs/reference/pandas_std.md new file mode 100644 index 0000000..2031b4d --- /dev/null +++ b/docs/reference/pandas_std.md @@ -0,0 +1,17 @@ +# Pandas Std +Computes the standard deviation of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_sub.md b/docs/reference/pandas_sub.md new file mode 100644 index 0000000..4f7c5d5 --- /dev/null +++ b/docs/reference/pandas_sub.md @@ -0,0 +1,18 @@ +# Pandas Sub +Subtracts a Pandas DataFrame from another DataFrame. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_sub_series.md b/docs/reference/pandas_sub_series.md new file mode 100644 index 0000000..e5442ed --- /dev/null +++ b/docs/reference/pandas_sub_series.md @@ -0,0 +1,18 @@ +# Pandas Sub Series +Subtracts a Pandas Series from a Pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_series | Series | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Arithmetic method + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_sum.md b/docs/reference/pandas_sum.md new file mode 100644 index 0000000..4580fe7 --- /dev/null +++ b/docs/reference/pandas_sum.md @@ -0,0 +1,17 @@ +# Pandas Sum +Computes the sum of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_summary.md b/docs/reference/pandas_summary.md new file mode 100644 index 0000000..e1648c8 --- /dev/null +++ b/docs/reference/pandas_summary.md @@ -0,0 +1,17 @@ +# Pandas Summary +Analyzes and summarizes a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_tan.md b/docs/reference/pandas_tan.md new file mode 100644 index 0000000..8d2784a --- /dev/null +++ b/docs/reference/pandas_tan.md @@ -0,0 +1,17 @@ +# Pandas Tan +Applies the tangent function to a pandas DataFrame and converting non-numeric values to NaN. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Math + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_to_string.md b/docs/reference/pandas_to_string.md new file mode 100644 index 0000000..5110588 --- /dev/null +++ b/docs/reference/pandas_to_string.md @@ -0,0 +1,17 @@ +# Pandas To String +Converts a pandas DataFrame to a string representation. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| String | + +
+Category: Display data + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_var.md b/docs/reference/pandas_var.md new file mode 100644 index 0000000..406534b --- /dev/null +++ b/docs/reference/pandas_var.md @@ -0,0 +1,17 @@ +# Pandas Var +Computes the variance of a pandas DataFrame. + +## Input +| Name | Data type | +|---|---| +| dataframe | DataFrame | + +## Output +| Data type | +|---| +| Series | + +
+Category: Summary statistics + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pandas_vertical_concat.md b/docs/reference/pandas_vertical_concat.md new file mode 100644 index 0000000..acdb03b --- /dev/null +++ b/docs/reference/pandas_vertical_concat.md @@ -0,0 +1,18 @@ +# Pandas Vertical Concat +Vertically concatenates two pandas DataFrames. + +## Input +| Name | Data type | +|---|---| +| a_dataframe | DataFrame | +| b_dataframe | DataFrame | + +## Output +| Data type | +|---| +| DataFrame | + +
+Category: Transformation + +ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/ug.md b/docs/ug.md index 6d365b8..55eb782 100644 --- a/docs/ug.md +++ b/docs/ug.md @@ -1,4 +1,7 @@ # User's Guide + +For a complete list of nodes, refer to [the Node reference](reference/node_reference.md). + ## Basic Concepts ### How to connect nodes for DataFrame To connect the DataFrame output from one Pandas node to another, move the wire toward the top-left of the text field. You may need to hover around the corner to find the correct connection point. diff --git a/examples/workflows/math.json b/examples/workflows/math.json new file mode 100644 index 0000000..7eab8bd --- /dev/null +++ b/examples/workflows/math.json @@ -0,0 +1 @@ +{"last_node_id":62,"last_link_id":67,"nodes":[{"id":32,"type":"PandasShowDataFrame","pos":[-99.37673950195312,2411.107421875],"size":[259.6763610839844,149.85391235351562],"flags":{},"order":2,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":24,"localized_name":"dataframe"}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6,"localized_name":"STRING"}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[" A B C\n0 1 3 Dog\n1 0 -1 Cat"]},{"id":15,"type":"PandasCreate","pos":[-90.01425170898438,2680.194580078125],"size":[229.8135223388672,145.6558380126953],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"DATAFRAME","type":"DATAFRAME","links":[24,50],"slot_index":0,"localized_name":"DATAFRAME"}],"properties":{"Node name for S&R":"PandasCreate"},"widgets_values":["A,B,C\n1,3,Dog\n0,-1,Cat\n"]},{"id":54,"type":"PandasShowDataFrame","pos":[662.09814453125,3067.4990234375],"size":[210,110.91275024414062],"flags":{},"order":9,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":55,"localized_name":"dataframe"}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6,"localized_name":"STRING"}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[" A\n0 0.500000\n1 0.707107"]},{"id":52,"type":"PandasCreate","pos":[-85.06178283691406,3245.229248046875],"size":[210,104.47671508789062],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"DATAFRAME","type":"DATAFRAME","links":[54,66,67],"slot_index":0,"localized_name":"DATAFRAME"}],"properties":{"Node name for S&R":"PandasCreate"},"widgets_values":["A\n0.523599\n0.785398\n"]},{"id":62,"type":"PandasTan","pos":[261.1204833984375,3409.043212890625],"size":[241.79998779296875,26],"flags":{},"order":6,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":67,"localized_name":"dataframe"}],"outputs":[{"name":"DATAFRAME","type":"DATAFRAME","links":[65],"slot_index":0,"localized_name":"DATAFRAME"}],"properties":{"Node name for S&R":"PandasTan"},"widgets_values":[]},{"id":61,"type":"PandasCos","pos":[257.1744384765625,3252.8525390625],"size":[241.79998779296875,26],"flags":{},"order":5,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":66,"localized_name":"dataframe"}],"outputs":[{"name":"DATAFRAME","type":"DATAFRAME","links":[62],"slot_index":0,"localized_name":"DATAFRAME"}],"properties":{"Node name for S&R":"PandasCos"},"widgets_values":[]},{"id":53,"type":"PandasSin","pos":[261.9440612792969,3062.6064453125],"size":[241.79998779296875,26],"flags":{},"order":4,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":54,"localized_name":"dataframe"}],"outputs":[{"name":"DATAFRAME","type":"DATAFRAME","links":[55],"slot_index":0,"localized_name":"DATAFRAME"}],"properties":{"Node name for S&R":"PandasSin"},"widgets_values":[]},{"id":57,"type":"PandasShowDataFrame","pos":[666.1212768554688,3245.68310546875],"size":[210,110.91275024414062],"flags":{},"order":10,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":62,"localized_name":"dataframe"}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6,"localized_name":"STRING"}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[" A\n0 0.866025\n1 0.707107"]},{"id":60,"type":"PandasShowDataFrame","pos":[666.99462890625,3428.74267578125],"size":[210,93.58164978027344],"flags":{},"order":11,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":65,"localized_name":"dataframe"}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6,"localized_name":"STRING"}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[" A\n0 0.577351\n1 1.000000"]},{"id":51,"type":"PandasShowDataFrame","pos":[664.6563110351562,2881.75341796875],"size":[210,100.41456604003906],"flags":{},"order":12,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":53,"localized_name":"dataframe"}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6,"localized_name":"STRING"}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[" A B C\n0 1.0 3.0 NaN\n1 0.0 -1.0 NaN"]},{"id":50,"type":"PandasLog","pos":[263.4460144042969,2887.0576171875],"size":[241.79998779296875,26],"flags":{},"order":8,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":52,"localized_name":"dataframe"}],"outputs":[{"name":"DATAFRAME","type":"DATAFRAME","links":[53],"slot_index":0,"localized_name":"DATAFRAME"}],"properties":{"Node name for S&R":"PandasLog"},"widgets_values":[]},{"id":49,"type":"PandasExp","pos":[264.65179443359375,2679.728759765625],"size":[241.79998779296875,26],"flags":{},"order":3,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":50,"localized_name":"dataframe"}],"outputs":[{"name":"DATAFRAME","type":"DATAFRAME","links":[51,52],"slot_index":0,"localized_name":"DATAFRAME"}],"properties":{"Node name for S&R":"PandasExp"},"widgets_values":[]},{"id":48,"type":"PandasShowDataFrame","pos":[658.8043823242188,2673.08935546875],"size":[210,114.4713134765625],"flags":{},"order":7,"mode":0,"inputs":[{"name":"dataframe","type":"DATAFRAME","link":51,"localized_name":"dataframe"}],"outputs":[{"name":"STRING","type":"STRING","links":null,"shape":6,"localized_name":"STRING"}],"properties":{"Node name for S&R":"PandasShowDataFrame"},"widgets_values":[" A B C\n0 2.718282 20.085537 NaN\n1 1.000000 0.367879 NaN"]}],"links":[[24,15,0,32,0,"DATAFRAME"],[50,15,0,49,0,"DATAFRAME"],[51,49,0,48,0,"DATAFRAME"],[52,49,0,50,0,"DATAFRAME"],[53,50,0,51,0,"DATAFRAME"],[54,52,0,53,0,"DATAFRAME"],[55,53,0,54,0,"DATAFRAME"],[62,61,0,57,0,"DATAFRAME"],[65,62,0,60,0,"DATAFRAME"],[66,52,0,61,0,"DATAFRAME"],[67,52,0,62,0,"DATAFRAME"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.6063861966040901,"offset":[766.8321983635497,-2260.668314957591]},"node_versions":{"data-analysis":"48793a15e2d6d227d06b7b58c7d90c806eb8134d"},"ue_links":[]},"version":0.4} \ No newline at end of file diff --git a/modules/cda/cda_json_create.py b/modules/cda/cda_json_create.py index f0fb9bb..3be19ec 100644 --- a/modules/cda/cda_json_create.py +++ b/modules/cda/cda_json_create.py @@ -3,8 +3,10 @@ import json class CDAJSONCreate: """ - CDAJSONCreate: - A class for creating a serialized JSON object using values entered in the text field. + CDA JSON Create: + Creates a serialized JSON object using values entered in the text field. + + category: IO """ @classmethod diff --git a/modules/matplotlib/mpl_bar.py b/modules/matplotlib/mpl_bar.py index c2f44e1..5e2a591 100644 --- a/modules/matplotlib/mpl_bar.py +++ b/modules/matplotlib/mpl_bar.py @@ -7,8 +7,10 @@ from .util import plot_post_steps class MPLBar: """ - MPLBar: - A class for generating bar charts from a pandas DataFrame. + MPL Bar Chart: + Generates a bar chart from a Pandas DataFrame. + + category: Plot """ @classmethod diff --git a/modules/matplotlib/mpl_line.py b/modules/matplotlib/mpl_line.py index fa74ee3..24077e8 100644 --- a/modules/matplotlib/mpl_line.py +++ b/modules/matplotlib/mpl_line.py @@ -7,8 +7,10 @@ from .util import plot_post_steps class MPLLine: """ - MPLPlotLine: - A class for generating line plots from a pandas DataFrame. + MPL Line Plot: + Generates a line plot from a pandas DataFrame. + + category: Plot """ @classmethod diff --git a/modules/matplotlib/mpl_scatter.py b/modules/matplotlib/mpl_scatter.py index 61b6122..635b604 100644 --- a/modules/matplotlib/mpl_scatter.py +++ b/modules/matplotlib/mpl_scatter.py @@ -7,8 +7,10 @@ from .util import plot_post_steps class MPLScatter: """ - MPLPlotScatter: - A class for generating scatter plots from a pandas DataFrame. + MPL Scatter Plot: + Generates a scatter plot from a pandas DataFrame. + + category: Plot """ @classmethod diff --git a/modules/pandas_wrapper/pandas_add.py b/modules/pandas_wrapper/pandas_add.py index 4b38152..c0d46f4 100644 --- a/modules/pandas_wrapper/pandas_add.py +++ b/modules/pandas_wrapper/pandas_add.py @@ -4,8 +4,9 @@ import pandas as pd class PandasAdd: """ - PandasAdd: - A class for adding two pandas DataFrames. + Adds two pandas DataFrames. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_add_series.py b/modules/pandas_wrapper/pandas_add_series.py index ed286e7..58b1cbd 100644 --- a/modules/pandas_wrapper/pandas_add_series.py +++ b/modules/pandas_wrapper/pandas_add_series.py @@ -3,8 +3,9 @@ import pandas as pd class PandasAddSeries: """ - PandasAdd: - A class for adding a Pandas Series to a pandas DataFrames. + Adds a Pandas Series to a pandas DataFrames. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_as_float.py b/modules/pandas_wrapper/pandas_as_float.py index 61a1d9a..ec7e502 100644 --- a/modules/pandas_wrapper/pandas_as_float.py +++ b/modules/pandas_wrapper/pandas_as_float.py @@ -5,8 +5,9 @@ import pandas as pd class PandasAsFloat: """ - PandasAsFloat: - A class for converting all cells in a pandas DataFrame to float type. + Converts all cells in a pandas DataFrame to float type. + + category: Data type conversion """ @classmethod diff --git a/modules/pandas_wrapper/pandas_as_int.py b/modules/pandas_wrapper/pandas_as_int.py index db0f125..5ba26da 100644 --- a/modules/pandas_wrapper/pandas_as_int.py +++ b/modules/pandas_wrapper/pandas_as_int.py @@ -5,8 +5,9 @@ import pandas as pd class PandasAsInt: """ - PandasAsInt: - A class for converting all cells in a pandas DataFrame to integer type. + Converts all cells in a pandas DataFrame to integer type. + + category: Data type conversion """ @classmethod diff --git a/modules/pandas_wrapper/pandas_as_string.py b/modules/pandas_wrapper/pandas_as_string.py index 76546cc..ed6631b 100644 --- a/modules/pandas_wrapper/pandas_as_string.py +++ b/modules/pandas_wrapper/pandas_as_string.py @@ -4,8 +4,9 @@ import pandas as pd class PandasAsString: """ - PandasAsString: - A class for converting all cells in a pandas DataFrame to string type. + Converts all cells in a pandas DataFrame to string type. + + category: Data type conversion """ @classmethod diff --git a/modules/pandas_wrapper/pandas_columns.py b/modules/pandas_wrapper/pandas_columns.py index b56fc04..8931981 100644 --- a/modules/pandas_wrapper/pandas_columns.py +++ b/modules/pandas_wrapper/pandas_columns.py @@ -4,8 +4,9 @@ import pandas as pd class PandasColumns: """ - PandasColumns: - A class for retrieving the column labels of a pandas DataFrame. + Retrieves the column labels of a pandas DataFrame. + + category: DataFrame information """ @classmethod diff --git a/modules/pandas_wrapper/pandas_cos.py b/modules/pandas_wrapper/pandas_cos.py new file mode 100644 index 0000000..d555cf9 --- /dev/null +++ b/modules/pandas_wrapper/pandas_cos.py @@ -0,0 +1,46 @@ +from typing import Any, Dict +import pandas as pd +import numpy as np + + +class PandasCos: + """ + Apply the cosine function to a pandas DataFrame and converting non-numeric values to NaN. + + category: Math + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the input types for the function. + + Returns: + Dict[str, Any]: A dictionary specifying required input types. + """ + return { + "required": { + "dataframe": ("DATAFRAME", {}) + } + } + + RETURN_TYPES: tuple = ("DATAFRAME",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self, dataframe: pd.DataFrame) -> tuple: + """ + Converts non-numeric values to NaN and applies the cosine function to the DataFrame. + + The cosine function returns the ratio of the adjacent side to the hypotenuse in a right triangle, + or equivalently, the x-coordinate of a point on the unit circle. + + Args: + dataframe (DataFrame): The DataFrame. + + Returns: + tuple: A tuple containing the processed DataFrame. + """ + dataframe = dataframe.apply(pd.to_numeric, errors='coerce') + dataframe = np.cos(dataframe) + return (dataframe,) diff --git a/modules/pandas_wrapper/pandas_count.py b/modules/pandas_wrapper/pandas_count.py index eac6a7a..001e273 100644 --- a/modules/pandas_wrapper/pandas_count.py +++ b/modules/pandas_wrapper/pandas_count.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasCount: """ - PandasCount: - A class for computing the count of a pandas DataFrame. + Computes the count of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_create.py b/modules/pandas_wrapper/pandas_create.py index 610ea6c..2f2e310 100644 --- a/modules/pandas_wrapper/pandas_create.py +++ b/modules/pandas_wrapper/pandas_create.py @@ -5,8 +5,9 @@ import pandas as pd class PandasCreate: """ - PandasCreate: - A class for creating a pandas DataFrame using values entered in the text field. + Creates a pandas DataFrame using values entered in the text field. + + category: IO """ @classmethod diff --git a/modules/pandas_wrapper/pandas_create_with_index.py b/modules/pandas_wrapper/pandas_create_with_index.py index c1ceb63..8eedb35 100644 --- a/modules/pandas_wrapper/pandas_create_with_index.py +++ b/modules/pandas_wrapper/pandas_create_with_index.py @@ -5,9 +5,9 @@ import pandas as pd class PandasCreateWithIndex: """ - PandasCreateWithIndex: - A class for creating a pandas DataFrame using values entered in the text field. - Input data is assume to have an index. + Creates a pandas DataFrame using values entered in the text field. Input data is assumed to have an index. + + category: IO """ @classmethod diff --git a/modules/pandas_wrapper/pandas_div.py b/modules/pandas_wrapper/pandas_div.py index a538bac..4acabbb 100644 --- a/modules/pandas_wrapper/pandas_div.py +++ b/modules/pandas_wrapper/pandas_div.py @@ -5,8 +5,9 @@ import pandas as pd class PandasDiv: """ - PandasDiv: - A class for dividing two pandas DataFrames. + Divides two pandas DataFrames. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_div_series.py b/modules/pandas_wrapper/pandas_div_series.py index e870dfc..1babb24 100644 --- a/modules/pandas_wrapper/pandas_div_series.py +++ b/modules/pandas_wrapper/pandas_div_series.py @@ -5,8 +5,9 @@ from .utils import jsons_to_series class PandasDivSeries: """ - PandasDivSeries: - A class for dividing a Pandas DataFrame by a Pandas Series. + Divides a Pandas DataFrame by a Pandas Series. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_dropna.py b/modules/pandas_wrapper/pandas_dropna.py index 10d0934..6d9ce10 100644 --- a/modules/pandas_wrapper/pandas_dropna.py +++ b/modules/pandas_wrapper/pandas_dropna.py @@ -3,8 +3,10 @@ import pandas as pd class PandasDropNA: """ - PandasColumns: - A class for droping missing values from a pandas DataFrame. + Pandas Drop NA: + Drops missing values from a pandas DataFrame. + + category: Data cleansing """ @classmethod diff --git a/modules/pandas_wrapper/pandas_exp.py b/modules/pandas_wrapper/pandas_exp.py new file mode 100644 index 0000000..d453a6d --- /dev/null +++ b/modules/pandas_wrapper/pandas_exp.py @@ -0,0 +1,43 @@ +from typing import Any, Dict +import pandas as pd +import numpy as np + + +class PandasExp: + """ + Apply the exponential function to a pandas DataFrame and converting non-numeric values to NaN. + + category: Math + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the input types for the function. + + Returns: + Dict[str, Any]: A dictionary specifying required input types. + """ + return { + "required": { + "dataframe": ("DATAFRAME", {}) + } + } + + RETURN_TYPES: tuple = ("DATAFRAME",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self, dataframe: pd.DataFrame) -> tuple: + """ + Converts non-numeric values to NaN and applies the exponential function to the DataFrame. + + Args: + dataframe (DataFrame): The DataFrame. + + Returns: + tuple: A tuple containing the processed DataFrame. + """ + dataframe = dataframe.apply(pd.to_numeric, errors='coerce') + dataframe = np.exp(dataframe) + return (dataframe,) diff --git a/modules/pandas_wrapper/pandas_group_by.py b/modules/pandas_wrapper/pandas_group_by.py index ad72d44..01f27cc 100644 --- a/modules/pandas_wrapper/pandas_group_by.py +++ b/modules/pandas_wrapper/pandas_group_by.py @@ -5,8 +5,9 @@ import pandas as pd class PandasGroupBy: """ - PandasGroupBy: - A class for computing aggregate values for groups in a DataFrame. + Computes aggregate values for groups in a DataFrame. + + category: Aggregation """ @classmethod diff --git a/modules/pandas_wrapper/pandas_head.py b/modules/pandas_wrapper/pandas_head.py index bc6ce78..cd7bf55 100644 --- a/modules/pandas_wrapper/pandas_head.py +++ b/modules/pandas_wrapper/pandas_head.py @@ -5,8 +5,9 @@ import pandas as pd class PandasHead: """ - PandasHead: - A class for retrieving the first few rows of a pandas DataFrame. + Retrieves the first few rows of a pandas DataFrame. + + category: Data subset selection """ @classmethod diff --git a/modules/pandas_wrapper/pandas_horizontal_concat.py b/modules/pandas_wrapper/pandas_horizontal_concat.py index 098e813..cca6cce 100644 --- a/modules/pandas_wrapper/pandas_horizontal_concat.py +++ b/modules/pandas_wrapper/pandas_horizontal_concat.py @@ -4,8 +4,9 @@ import pandas as pd class PandasHorizontalConcat: """ - PandasHorizontalConcat: - A class for horizontally concatenating two pandas DataFrames. + Horizontally concatenates two pandas DataFrames. + + category: Transformation """ @classmethod diff --git a/modules/pandas_wrapper/pandas_iloc_row_series.py b/modules/pandas_wrapper/pandas_iloc_row_series.py index 661f1a8..4a9e787 100644 --- a/modules/pandas_wrapper/pandas_iloc_row_series.py +++ b/modules/pandas_wrapper/pandas_iloc_row_series.py @@ -5,10 +5,11 @@ from .utils import series_to_jsons 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. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html + Selects 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. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html + + category: Data subset selection """ @classmethod diff --git a/modules/pandas_wrapper/pandas_iloc_rows_dataframe.py b/modules/pandas_wrapper/pandas_iloc_rows_dataframe.py index 3fb5a8b..b1f8b0d 100644 --- a/modules/pandas_wrapper/pandas_iloc_rows_dataframe.py +++ b/modules/pandas_wrapper/pandas_iloc_rows_dataframe.py @@ -6,9 +6,10 @@ from .utils import series_to_jsons class PandasIlocRowsDataFrame: """ - PandasIlocRowsDataFrame: - A class for selecting rows from a pandas DataFrame and returning it as a DataFrame. - Rows are specified by the list of integer positions. + Selects rows from a pandas DataFrame and returning it as a DataFrame. + Rows are specified by the list of integer positions. + + category: Data subset selection """ @classmethod diff --git a/modules/pandas_wrapper/pandas_index.py b/modules/pandas_wrapper/pandas_index.py index f9e2871..fc9de9a 100644 --- a/modules/pandas_wrapper/pandas_index.py +++ b/modules/pandas_wrapper/pandas_index.py @@ -3,8 +3,9 @@ import pandas as pd class PandasIndex: """ - PandasColumns: - A class for retrieving the row labels (index) of a pandas DataFrame. + Retrieves the row labels (index) of a pandas DataFrame. + + category: DataFrame information """ @classmethod diff --git a/modules/pandas_wrapper/pandas_index_to_string.py b/modules/pandas_wrapper/pandas_index_to_string.py index e38653e..8626416 100644 --- a/modules/pandas_wrapper/pandas_index_to_string.py +++ b/modules/pandas_wrapper/pandas_index_to_string.py @@ -4,8 +4,9 @@ import pandas as pd class PandasIndexToString: """ - PandasIndexToString: - A class for converting a pandas Index to a string representation. + Converts a pandas Index to a string representation. + + category: Display data """ @classmethod diff --git a/modules/pandas_wrapper/pandas_isna.py b/modules/pandas_wrapper/pandas_isna.py index 5c98edf..7327a89 100644 --- a/modules/pandas_wrapper/pandas_isna.py +++ b/modules/pandas_wrapper/pandas_isna.py @@ -4,8 +4,10 @@ import pandas as pd class PandasIsNA: """ - PandasColumns: - A class for checking a pandas DataFrame for missing values. + Pandas Is NA: + Checks a pandas DataFrame for missing values. + + category: Data cleansing """ @classmethod diff --git a/modules/pandas_wrapper/pandas_join.py b/modules/pandas_wrapper/pandas_join.py index a6f95f9..4ac1936 100644 --- a/modules/pandas_wrapper/pandas_join.py +++ b/modules/pandas_wrapper/pandas_join.py @@ -5,8 +5,9 @@ import pandas as pd class PandasJoin: """ - PandasJoin: - A class for merging two pandas DataFrames based on a common column. + Merges two pandas DataFrames based on a common column. + + category: Transformation """ @classmethod diff --git a/modules/pandas_wrapper/pandas_load_csv.py b/modules/pandas_wrapper/pandas_load_csv.py index 89aa83d..b1522b2 100644 --- a/modules/pandas_wrapper/pandas_load_csv.py +++ b/modules/pandas_wrapper/pandas_load_csv.py @@ -5,8 +5,10 @@ import pandas as pd class PandasLoadCSV: """ - PandasLoadCSV: - A class for loading CSV files into a pandas DataFrame. + Pandas Load CSV: + Loads CSV files into a pandas DataFrame. + + category: IO """ @classmethod diff --git a/modules/pandas_wrapper/pandas_load_csv_with_encoding.py b/modules/pandas_wrapper/pandas_load_csv_with_encoding.py index 66b4bab..78c5f57 100644 --- a/modules/pandas_wrapper/pandas_load_csv_with_encoding.py +++ b/modules/pandas_wrapper/pandas_load_csv_with_encoding.py @@ -5,8 +5,10 @@ import pandas as pd class PandasLoadCSVWithEncoding: """ - PandasLoadCSVWithEncoding: - A class for loading CSV files into a pandas DataFrame. + Pandas Load CSV With Encoding: + Loads CSV files into a pandas DataFrame. + + category: IO """ @classmethod diff --git a/modules/pandas_wrapper/pandas_load_csv_with_index.py b/modules/pandas_wrapper/pandas_load_csv_with_index.py index 721b5b8..ef0dd8f 100644 --- a/modules/pandas_wrapper/pandas_load_csv_with_index.py +++ b/modules/pandas_wrapper/pandas_load_csv_with_index.py @@ -5,9 +5,11 @@ import pandas as pd class PandasLoadCSVWithIndex: """ - PandasLoadCSV: - A class for loading CSV files into a pandas DataFrame. - Input data is assume to have an index. + Pandas Load CSV With Index: + Loads CSV files into a pandas DataFrame. + Input data is assume to have an index. + + category: IO """ @classmethod diff --git a/modules/pandas_wrapper/pandas_load_json.py b/modules/pandas_wrapper/pandas_load_json.py index f41ba24..37b53c0 100644 --- a/modules/pandas_wrapper/pandas_load_json.py +++ b/modules/pandas_wrapper/pandas_load_json.py @@ -5,8 +5,10 @@ import pandas as pd class PandasLoadJSON: """ - PandasLoadJSON: - A class for loading JSON files into a pandas DataFrame. + Pandas Load JSON: + Loads JSON files into a pandas DataFrame. + + category: IO """ @classmethod diff --git a/modules/pandas_wrapper/pandas_loc_cell_str.py b/modules/pandas_wrapper/pandas_loc_cell_str.py index 559df40..9858474 100644 --- a/modules/pandas_wrapper/pandas_loc_cell_str.py +++ b/modules/pandas_wrapper/pandas_loc_cell_str.py @@ -4,8 +4,9 @@ import pandas as pd class PandasLocCellStr: """ - PandasLocCellStr: - A class for selecting a cell from a pandas DataFrame and output as a string. + Selects a cell from a pandas DataFrame and output as a string. + + category: Data subset selection """ @classmethod diff --git a/modules/pandas_wrapper/pandas_loc_row_series.py b/modules/pandas_wrapper/pandas_loc_row_series.py index d0c284c..e65726a 100644 --- a/modules/pandas_wrapper/pandas_loc_row_series.py +++ b/modules/pandas_wrapper/pandas_loc_row_series.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasLocRowSeries: """ - PandasLocRowSeries: - A class for selecting a row from a pandas DataFrame and output as a Series. + Selects a row from a pandas DataFrame and output as a Series. + + category: Data subset selection """ @classmethod diff --git a/modules/pandas_wrapper/pandas_log.py b/modules/pandas_wrapper/pandas_log.py new file mode 100644 index 0000000..63f2194 --- /dev/null +++ b/modules/pandas_wrapper/pandas_log.py @@ -0,0 +1,43 @@ +from typing import Any, Dict +import pandas as pd +import numpy as np + + +class PandasLog: + """ + Applying the natural logarithm function to a pandas DataFrame and converting non-numeric values to NaN. + + category: Math + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the input types for the function. + + Returns: + Dict[str, Any]: A dictionary specifying required input types. + """ + return { + "required": { + "dataframe": ("DATAFRAME", {}) + } + } + + RETURN_TYPES: tuple = ("DATAFRAME",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self, dataframe: pd.DataFrame) -> tuple: + """ + Converts non-numeric values to NaN and applies the natural logarithm function to the DataFrame. + + Args: + dataframe (DataFrame): The DataFrame. + + Returns: + tuple: A tuple containing the processed DataFrame. + """ + dataframe = dataframe.apply(pd.to_numeric, errors='coerce') + dataframe = np.log(dataframe) + return (dataframe,) diff --git a/modules/pandas_wrapper/pandas_max.py b/modules/pandas_wrapper/pandas_max.py index e3176e8..3e64a64 100644 --- a/modules/pandas_wrapper/pandas_max.py +++ b/modules/pandas_wrapper/pandas_max.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasMax: """ - PandasMin: - A class for computing the max of a pandas DataFrame. + Computes the max of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_mean.py b/modules/pandas_wrapper/pandas_mean.py index 4e180cd..1a9087b 100644 --- a/modules/pandas_wrapper/pandas_mean.py +++ b/modules/pandas_wrapper/pandas_mean.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasMean: """ - PandasMin: - A class for computing the mean of a pandas DataFrame. + Computes the mean of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_median.py b/modules/pandas_wrapper/pandas_median.py index 053dfa0..874251c 100644 --- a/modules/pandas_wrapper/pandas_median.py +++ b/modules/pandas_wrapper/pandas_median.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasMedian: """ - PandasMin: - A class for computing the median of a pandas DataFrame. + Computes the median of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_min.py b/modules/pandas_wrapper/pandas_min.py index f8bc68a..8e624bb 100644 --- a/modules/pandas_wrapper/pandas_min.py +++ b/modules/pandas_wrapper/pandas_min.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasMin: """ - PandasMin: - A class for computing the min of a pandas DataFrame. + Computes the min of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_mode.py b/modules/pandas_wrapper/pandas_mode.py index d7560e1..ac5e2fe 100644 --- a/modules/pandas_wrapper/pandas_mode.py +++ b/modules/pandas_wrapper/pandas_mode.py @@ -4,8 +4,9 @@ import pandas as pd class PandasMode: """ - PandasMode: - A class for computing the mode of a pandas DataFrame. + Computes the mode of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_mul.py b/modules/pandas_wrapper/pandas_mul.py index 6e664c4..c4e67a6 100644 --- a/modules/pandas_wrapper/pandas_mul.py +++ b/modules/pandas_wrapper/pandas_mul.py @@ -5,8 +5,9 @@ import pandas as pd class PandasMul: """ - PandasMul: - A class for multiplying two pandas DataFrames. + Multiplies two pandas DataFrames. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_mul_series.py b/modules/pandas_wrapper/pandas_mul_series.py index b81b306..7df9615 100644 --- a/modules/pandas_wrapper/pandas_mul_series.py +++ b/modules/pandas_wrapper/pandas_mul_series.py @@ -5,8 +5,9 @@ from .utils import jsons_to_series class PandasMulSeries: """ - PandasMulSeries: - A class for multiplying a Pandas DataFrame by a Pandas Series. + Multiplies a Pandas DataFrame by a Pandas Series. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_pow.py b/modules/pandas_wrapper/pandas_pow.py index 1555b54..b5f3ec7 100644 --- a/modules/pandas_wrapper/pandas_pow.py +++ b/modules/pandas_wrapper/pandas_pow.py @@ -5,8 +5,9 @@ import pandas as pd class PandasPow: """ - PandasPow: - A class for exponentiating two pandas DataFrames. + Exponentiates two pandas DataFrames. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_pow_series.py b/modules/pandas_wrapper/pandas_pow_series.py index a21a9b6..679c677 100644 --- a/modules/pandas_wrapper/pandas_pow_series.py +++ b/modules/pandas_wrapper/pandas_pow_series.py @@ -5,8 +5,9 @@ from .utils import jsons_to_series class PandasPowSeries: """ - PandasPowSeries: - A class for raising a Pandas DataFrame to the power of a Pandas Series. + Raises a Pandas DataFrame to the power of a Pandas Series. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_save_csv.py b/modules/pandas_wrapper/pandas_save_csv.py index 3d059b3..53aeac2 100644 --- a/modules/pandas_wrapper/pandas_save_csv.py +++ b/modules/pandas_wrapper/pandas_save_csv.py @@ -10,8 +10,10 @@ import pandas as pd class PandasSaveCSV: """ - PandasSaveCSV: - A class for saving a PandasDataFrame to a CSV file. + Pandas Save CSV: + Saves a PandasDataFrame to a CSV file. + + category: IO """ @classmethod def INPUT_TYPES(s): diff --git a/modules/pandas_wrapper/pandas_save_json.py b/modules/pandas_wrapper/pandas_save_json.py index f6c895a..6d51f2a 100644 --- a/modules/pandas_wrapper/pandas_save_json.py +++ b/modules/pandas_wrapper/pandas_save_json.py @@ -10,8 +10,10 @@ import pandas as pd class PandasSaveJSON: """ - PandasSaveJSON: - A class for saving a PandasDataFrame to a JSON file. + Pandas Save JSON: + Saves a PandasDataFrame to a JSON file. + + category: IO """ @classmethod def INPUT_TYPES(s): diff --git a/modules/pandas_wrapper/pandas_select_columns.py b/modules/pandas_wrapper/pandas_select_columns.py index 76310af..eee1775 100644 --- a/modules/pandas_wrapper/pandas_select_columns.py +++ b/modules/pandas_wrapper/pandas_select_columns.py @@ -4,8 +4,9 @@ import pandas as pd class PandasSelectColumns: """ - PandasSelectColumns: - A class for selecting specific columns from a pandas DataFrame. + Selects specific columns from a pandas DataFrame. + + category: Data subset selection """ @classmethod diff --git a/modules/pandas_wrapper/pandas_select_rows.py b/modules/pandas_wrapper/pandas_select_rows.py index 64f2e4a..953231e 100644 --- a/modules/pandas_wrapper/pandas_select_rows.py +++ b/modules/pandas_wrapper/pandas_select_rows.py @@ -4,8 +4,9 @@ import pandas as pd class PandasSelectRows: """ - PandasSelectRows: - A class for selecting specific rows from a pandas DataFrame based on a condition. + Selects specific rows from a pandas DataFrame based on a condition. + + category: Data subset selection """ @classmethod diff --git a/modules/pandas_wrapper/pandas_series_to_string.py b/modules/pandas_wrapper/pandas_series_to_string.py index e427146..e18c512 100644 --- a/modules/pandas_wrapper/pandas_series_to_string.py +++ b/modules/pandas_wrapper/pandas_series_to_string.py @@ -5,8 +5,9 @@ from .utils import jsons_to_series class PandasSeriesToString: """ - PandasSeriesToString: - A class for converting a pandas Series to a string representation. + Converts a pandas Series to a string representation. + + category: Display data """ @classmethod diff --git a/modules/pandas_wrapper/pandas_show_dataframe.py b/modules/pandas_wrapper/pandas_show_dataframe.py index 169bee1..971d0f3 100644 --- a/modules/pandas_wrapper/pandas_show_dataframe.py +++ b/modules/pandas_wrapper/pandas_show_dataframe.py @@ -8,6 +8,11 @@ from io import StringIO import pandas as pd class PandasShowDataFrame: + """ + Displays a Pandas DataFrame as text. + + category: Display data + """ @classmethod def INPUT_TYPES(s): return { diff --git a/modules/pandas_wrapper/pandas_show_index.py b/modules/pandas_wrapper/pandas_show_index.py index b2fc0c6..7f8ff83 100644 --- a/modules/pandas_wrapper/pandas_show_index.py +++ b/modules/pandas_wrapper/pandas_show_index.py @@ -7,6 +7,11 @@ See credit/credit.md for the full license. import pandas as pd class PandasShowIndex: + """ + Displays a Pandas Index as text. + + category: Display data + """ @classmethod def INPUT_TYPES(s): return { diff --git a/modules/pandas_wrapper/pandas_show_series.py b/modules/pandas_wrapper/pandas_show_series.py index 27cdf3a..ea4982d 100644 --- a/modules/pandas_wrapper/pandas_show_series.py +++ b/modules/pandas_wrapper/pandas_show_series.py @@ -10,6 +10,11 @@ from .utils import series_to_jsons from .utils import jsons_to_series class PandasShowSeries: + """ + Displays a Pandas Series as text. + + category: Display data + """ @classmethod def INPUT_TYPES(s): return { diff --git a/modules/pandas_wrapper/pandas_show_text.py b/modules/pandas_wrapper/pandas_show_text.py index d64dc81..f57183d 100644 --- a/modules/pandas_wrapper/pandas_show_text.py +++ b/modules/pandas_wrapper/pandas_show_text.py @@ -6,6 +6,11 @@ See credit/credit.md for the full license. """ class PandasShowText: + """ + Displays a string. + + category: Display data + """ @classmethod def INPUT_TYPES(s): return { diff --git a/modules/pandas_wrapper/pandas_sin.py b/modules/pandas_wrapper/pandas_sin.py new file mode 100644 index 0000000..e87abe5 --- /dev/null +++ b/modules/pandas_wrapper/pandas_sin.py @@ -0,0 +1,46 @@ +from typing import Any, Dict +import pandas as pd +import numpy as np + + +class PandasSin: + """ + Applies the sine function to a pandas DataFrame and converting non-numeric values to NaN. + + category: Math + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the input types for the function. + + Returns: + Dict[str, Any]: A dictionary specifying required input types. + """ + return { + "required": { + "dataframe": ("DATAFRAME", {}) + } + } + + RETURN_TYPES: tuple = ("DATAFRAME",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self, dataframe: pd.DataFrame) -> tuple: + """ + Converts non-numeric values to NaN and applies the sine function to the DataFrame. + + The sine function returns the ratio of the opposite side to the hypotenuse in a right triangle, + or equivalently, the y-coordinate of a point on the unit circle. + + Args: + dataframe (DataFrame): The DataFrame. + + Returns: + tuple: A tuple containing the processed DataFrame. + """ + dataframe = dataframe.apply(pd.to_numeric, errors='coerce') + dataframe = np.sin(dataframe) + return (dataframe,) diff --git a/modules/pandas_wrapper/pandas_sort.py b/modules/pandas_wrapper/pandas_sort.py index b289edc..21b17a5 100644 --- a/modules/pandas_wrapper/pandas_sort.py +++ b/modules/pandas_wrapper/pandas_sort.py @@ -4,8 +4,9 @@ import pandas as pd class PandasSort: """ - PandasSort: - A class for sorting a pandas DataFrame by a specified column. + Sorts a pandas DataFrame by a specified column. + + category: Transformation """ @classmethod diff --git a/modules/pandas_wrapper/pandas_std.py b/modules/pandas_wrapper/pandas_std.py index 2e91cb1..92ba245 100644 --- a/modules/pandas_wrapper/pandas_std.py +++ b/modules/pandas_wrapper/pandas_std.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasStd: """ - PandasStd: - A class for computing the standard deviation of a pandas DataFrame. + Computes the standard deviation of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_sub.py b/modules/pandas_wrapper/pandas_sub.py index 7ccba05..708c931 100644 --- a/modules/pandas_wrapper/pandas_sub.py +++ b/modules/pandas_wrapper/pandas_sub.py @@ -5,8 +5,9 @@ import pandas as pd class PandasSub: """ - PandasSub: - A class for subtracting two pandas DataFrames. + Subtracts a Pandas DataFrame from another DataFrame. + + category: Arithmetic method """ @classmethod @@ -30,7 +31,7 @@ class PandasSub: def f(self, a_dataframe: pd.DataFrame, b_dataframe: pd.DataFrame) -> tuple: """ - Subtract two pandas DataFrames. + Subtracts a Pandas DataFrame from another DataFrame. Args: a_dataframe (DataFrame): The left DataFrame. diff --git a/modules/pandas_wrapper/pandas_sub_series.py b/modules/pandas_wrapper/pandas_sub_series.py index b259f9c..fa9db8c 100644 --- a/modules/pandas_wrapper/pandas_sub_series.py +++ b/modules/pandas_wrapper/pandas_sub_series.py @@ -5,8 +5,9 @@ from .utils import jsons_to_series class PandasSubSeries: """ - PandasSubSeries: - A class for subtracting a Pandas Series from a Pandas DataFrame. + Subtracts a Pandas Series from a Pandas DataFrame. + + category: Arithmetic method """ @classmethod diff --git a/modules/pandas_wrapper/pandas_sum.py b/modules/pandas_wrapper/pandas_sum.py index 83f7ebb..f5c32e7 100644 --- a/modules/pandas_wrapper/pandas_sum.py +++ b/modules/pandas_wrapper/pandas_sum.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasSum: """ - PandasSum: - A class for computing the sum of a pandas DataFrame. + Computes the sum of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_summary.py b/modules/pandas_wrapper/pandas_summary.py index cbe856f..731ca88 100644 --- a/modules/pandas_wrapper/pandas_summary.py +++ b/modules/pandas_wrapper/pandas_summary.py @@ -4,8 +4,9 @@ import pandas as pd class PandasSummary: """ - PandasSummary: - A class for analyzing and summarizing a pandas DataFrame. + Analyzes and summarizes a pandas DataFrame. + + category: Summary statistics """ @classmethod @@ -34,7 +35,7 @@ class PandasSummary: dataframe (DataFrame): The DataFrame. Returns: - tuple: A tuple containing a string representation of the DataFrame summary. + tuple: A tuple containing the DataFrame summary. """ summary = dataframe.describe() - return (str(summary),) + return (summary,) diff --git a/modules/pandas_wrapper/pandas_tan.py b/modules/pandas_wrapper/pandas_tan.py new file mode 100644 index 0000000..721add6 --- /dev/null +++ b/modules/pandas_wrapper/pandas_tan.py @@ -0,0 +1,46 @@ +from typing import Any, Dict +import pandas as pd +import numpy as np + + +class PandasTan: + """ + Applies the tangent function to a pandas DataFrame and converting non-numeric values to NaN. + + category: Math + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the input types for the function. + + Returns: + Dict[str, Any]: A dictionary specifying required input types. + """ + return { + "required": { + "dataframe": ("DATAFRAME", {}) + } + } + + RETURN_TYPES: tuple = ("DATAFRAME",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self, dataframe: pd.DataFrame) -> tuple: + """ + Converts non-numeric values to NaN and applies the tangent function to the DataFrame. + + The tangent function is the ratio of the sine to the cosine, representing the slope of a line + from the origin to a point on the unit circle. + + Args: + dataframe (DataFrame): The DataFrame. + + Returns: + tuple: A tuple containing the processed DataFrame. + """ + dataframe = dataframe.apply(pd.to_numeric, errors='coerce') + dataframe = np.tan(dataframe) + return (dataframe,) diff --git a/modules/pandas_wrapper/pandas_to_string.py b/modules/pandas_wrapper/pandas_to_string.py index 55ece59..e20cd60 100644 --- a/modules/pandas_wrapper/pandas_to_string.py +++ b/modules/pandas_wrapper/pandas_to_string.py @@ -4,8 +4,9 @@ import pandas as pd class PandasToString: """ - PandasToString: - A class for converting a pandas DataFrame to a string representation. + Converts a pandas DataFrame to a string representation. + + category: Display data """ @classmethod diff --git a/modules/pandas_wrapper/pandas_var.py b/modules/pandas_wrapper/pandas_var.py index d3d9c17..26d5b20 100644 --- a/modules/pandas_wrapper/pandas_var.py +++ b/modules/pandas_wrapper/pandas_var.py @@ -5,8 +5,9 @@ from .utils import series_to_jsons class PandasVar: """ - PandasVar: - A class for computing the variance of a pandas DataFrame. + Computes the variance of a pandas DataFrame. + + category: Summary statistics """ @classmethod diff --git a/modules/pandas_wrapper/pandas_vertical_concat.py b/modules/pandas_wrapper/pandas_vertical_concat.py index a2d8681..f6b6242 100644 --- a/modules/pandas_wrapper/pandas_vertical_concat.py +++ b/modules/pandas_wrapper/pandas_vertical_concat.py @@ -4,8 +4,9 @@ import pandas as pd class PandasVerticalConcat: """ - PandasVerticalConcat: - A class for vertically concatenating two pandas DataFrames. + Vertically concatenates two pandas DataFrames. + + category: Transformation """ @classmethod diff --git a/modules/pandas_wrapper/utils.py b/modules/pandas_wrapper/utils.py index 77aff4d..1ebf63d 100644 --- a/modules/pandas_wrapper/utils.py +++ b/modules/pandas_wrapper/utils.py @@ -69,6 +69,8 @@ class NpEncoder(json.JSONEncoder): Source: https://stackoverflow.com/questions/50916422/python-typeerror-object-of-type-int64-is-not-json-serializable Author: Jie Yang, Tommy Licensed under CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) + + pragma: skip_doc """ def default(self, obj): if isinstance(obj, np.integer): diff --git a/pyproject.toml b/pyproject.toml index 9e7089c..014035f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "data-analysis" description = "Data analysis custom modules for ComfyUI - Use Pandas & Matplotlib within ComfyUI" -version = "1.1.4" +version = "1.1.5" license = {file = "LICENSE"} [project.urls]