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.

  1. The API Request component retrieves data with only source and result fields. For this example, the desired data is nested within the result field.

  2. Connect a Lambda Filter to the API request component, and a Language model to the Lambda Filter. This example connects a Groq model component.

  3. In the Groq model component, add your Groq API key.

  4. 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

  1. To run the flow, in the Lambda Filter component, click .

  2. 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       | 67890
  1. Add the DataFrame Operations component, and a Chat Output component to the flow.

  2. In the DataFrame Operations component, in the Operation field, select Filter.

  3. To apply a filter, in the Column Name field, enter a column to filter on. This example filters by name.

  4. Click Playground, and then click Run Flow. The flow extracts the values from the name column.

name Emily Johnson Michael Williams John Smith ...

Operations

This component can perform the following operations on Pandas DataFrame.

Operation
Description
Required Inputs

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

Name
Display Name
Info

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

Name
Display Name
Info

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