Major refactoring to pass DataFrame object without serializing. Almost all nodes were modified for this. Binary operator nodes were added as well.
This commit is contained in:
@@ -7,7 +7,7 @@ def common_input_types():
|
||||
"""
|
||||
return {
|
||||
"required": {
|
||||
"dataframe_json": ("STRING", {"multiscatter": True}),
|
||||
"dataframe": ("STRING", {"multiscatter": True}),
|
||||
"x_column_name": ("STRING", {"default": ""}),
|
||||
"y_column_name": ("STRING", {"default": ""}),
|
||||
"title": ("STRING", {"default": ""}),
|
||||
|
||||
@@ -26,7 +26,7 @@ class MPLBar:
|
||||
CATEGORY: str = "Data Analysis"
|
||||
|
||||
def bar_chart(self,
|
||||
dataframe_json: str,
|
||||
dataframe: pd.DataFrame,
|
||||
x_column_name: str,
|
||||
y_column_name: str,
|
||||
title: str,
|
||||
@@ -37,7 +37,7 @@ class MPLBar:
|
||||
Generates a bar chart from a pandas DataFrame.
|
||||
|
||||
Args:
|
||||
dataframe_json (str): A JSON string representation of the DataFrame.
|
||||
dataframe (DataFrame): The DataFrame.
|
||||
x_column_name (str): The column name for the x-axis.
|
||||
y_column_name (str): The column name for the y-axis.
|
||||
title (str): The title of the plot.
|
||||
@@ -49,8 +49,8 @@ class MPLBar:
|
||||
Returns:
|
||||
tuple: A tuple containing the image tensor representation of the plot.
|
||||
"""
|
||||
# Deserialize JSON string to DataFrame
|
||||
df = pd.read_json(StringIO(dataframe_json))
|
||||
|
||||
df = dataframe
|
||||
|
||||
# Create the plot
|
||||
fig, ax = plt.subplots()
|
||||
|
||||
@@ -26,7 +26,7 @@ class MPLLine:
|
||||
CATEGORY: str = "Data Analysis"
|
||||
|
||||
def line_plot(self,
|
||||
dataframe_json: str,
|
||||
dataframe: pd.DataFrame,
|
||||
x_column_name: str,
|
||||
y_column_name: str,
|
||||
title: str,
|
||||
@@ -37,7 +37,7 @@ class MPLLine:
|
||||
Generates a line plot from a pandas DataFrame.
|
||||
|
||||
Args:
|
||||
dataframe_json (str): A JSON string representation of the DataFrame.
|
||||
dataframe (DataFrame): The DataFrame.
|
||||
x_column_name (str): The column name for the x-axis.
|
||||
y_column_name (str): The column name for the y-axis.
|
||||
title (str): The title of the plot.
|
||||
@@ -49,8 +49,8 @@ class MPLLine:
|
||||
Returns:
|
||||
tuple: A tuple containing the image tensor representation of the plot.
|
||||
"""
|
||||
# Deserialize JSON string to DataFrame
|
||||
df = pd.read_json(StringIO(dataframe_json))
|
||||
|
||||
df = dataframe
|
||||
|
||||
# Create the plot
|
||||
fig, ax = plt.subplots()
|
||||
|
||||
@@ -26,7 +26,7 @@ class MPLScatter:
|
||||
CATEGORY: str = "Data Analysis"
|
||||
|
||||
def scatter_plot(self,
|
||||
dataframe_json: str,
|
||||
dataframe: pd.DataFrame,
|
||||
x_column_name: str,
|
||||
y_column_name: str,
|
||||
title: str,
|
||||
@@ -37,7 +37,7 @@ class MPLScatter:
|
||||
Generates a scatter plot from a pandas DataFrame.
|
||||
|
||||
Args:
|
||||
dataframe_json (str): A JSON string representation of the DataFrame.
|
||||
dataframe (DataFrame): The DataFrame.
|
||||
x_column_name (str): The column name for the x-axis.
|
||||
y_column_name (str): The column name for the y-axis.
|
||||
title (str): The title of the plot.
|
||||
@@ -49,8 +49,8 @@ class MPLScatter:
|
||||
Returns:
|
||||
tuple: A tuple containing the image tensor representation of the plot.
|
||||
"""
|
||||
# Deserialize JSON string to DataFrame
|
||||
df = pd.read_json(StringIO(dataframe_json))
|
||||
|
||||
df = dataframe
|
||||
|
||||
# Create the plot
|
||||
fig, ax = plt.subplots()
|
||||
|
||||
Reference in New Issue
Block a user