DataFrame Operations
DataFrame operations provide powerful data manipulation capabilities for structured data processing within BroxiAI workflows.
DataFrame Operations
This component performs operations on DataFrame rows and columns.
To use this component in a flow, connect a component that outputs DataFrame to the DataFrame Operations component.
This example fetches JSON data from an API. The Lambda filter component extracts and flattens the results into a tabular DataFrame. The DataFrame Operations component can then work with the retrieved data.
The API Request component retrieves data with only
sourceandresultfields. For this example, the desired data is nested within theresultfield.Connect a Lambda Filter to the API request component, and a Language model to the Lambda Filter. This example connects a Groq model component.
In the Groq model component, add your Groq API key.
To filter the data, in the Lambda filter component, in the Instructions field, use natural language to describe how the data should be filtered. For this example, enter:
I want to explode the result column out into a Data object
Avoid punctuation in the Instructions field, as it can cause errors.
To run the flow, in the Lambda Filter component, click .
To inspect the filtered data, in the Lambda Filter component, click . The result is a structured DataFrame.
id | name | company | username | email | address | zip
---|------------------|----------------------|-----------------|------------------------------------|-------------------|-------
1 | Emily Johnson | ABC Corporation | emily_johnson | emily.johnson@abccorporation.com | 123 Main St | 12345
2 | Michael Williams | XYZ Corp | michael_williams| michael.williams@xyzcorp.com | 456 Elm Ave | 67890Add the DataFrame Operations component, and a Chat Output component to the flow.
In the DataFrame Operations component, in the Operation field, select Filter.
To apply a filter, in the Column Name field, enter a column to filter on. This example filters by
name.Click Playground, and then click Run Flow. The flow extracts the values from the
namecolumn.
name Emily Johnson Michael Williams John Smith ...
Operations
This component can perform the following operations on Pandas DataFrame.
Add Column
Adds a new column with a constant value
new_column_name, new_column_value
Drop Column
Removes a specified column
column_name
Filter
Filters rows based on column value
column_name, filter_value
Head
Returns first n rows
num_rows
Rename Column
Renames an existing column
column_name, new_column_name
Replace Value
Replaces values in a column
column_name, replace_value, replacement_value
Select Columns
Selects specific columns
columns_to_select
Sort
Sorts DataFrame by column
column_name, ascending
Tail
Returns last n rows
num_rows
Inputs
df
DataFrame
The input DataFrame to operate on.
operation
Operation
Select the DataFrame operation to perform. Options: Add Column, Drop Column, Filter, Head, Rename Column, Replace Value, Select Columns, Sort, Tail
column_name
Column Name
The column name to use for the operation.
filter_value
Filter Value
The value to filter rows by.
ascending
Sort Ascending
Whether to sort in ascending order.
new_column_name
New Column Name
The new column name when renaming or adding a column.
new_column_value
New Column Value
The value to populate the new column with.
columns_to_select
Columns to Select
List of column names to select.
num_rows
Number of Rows
Number of rows to return (for head/tail). Default: 5
replace_value
Value to Replace
The value to replace in the column.
replacement_value
Replacement Value
The value to replace with.
Outputs
output
DataFrame
The resulting DataFrame after the operation.
Usage Notes
Comprehensive Operations: Full range of common DataFrame manipulations
Flexible Filtering: Multiple ways to filter and select data
Column Management: Add, remove, rename, and modify columns
Data Analysis: Sort, head, and tail operations for data exploration
Value Replacement: Find and replace functionality for data cleaning
Integration Ready: Works seamlessly with other BroxiAI components
Last updated