Skip to main content
Version: 1.10.x (Next)

Table Operations

tip

Prior to Langflow 1.9.0, this component was named DataFrame Operations.

The Table Operations component performs operations on Table rows and columns, including schema changes, record changes, sorting, and filtering. For all options, see Table Operations parameters.

The output is a new Table containing the modified data after running the selected operation.

Use the Table Operations component in a flow

The following steps explain how to configure a Table Operations component in a flow. You can follow along with an example or use your own flow. The only requirement is that the preceding component must create Table output that you can pass to the Table Operations component.

  1. Create a new flow or use an existing flow.

    Example: API response extraction flow

    The following example flow uses five components to extract JSON from an API response, transform it to a Table, and then perform further processing on tabular data using a Table Operations component. The sixth component, Chat Output, is optional in this example. It only serves as a convenient way for you to view the final output in the Playground, rather than inspecting the component logs.

    A flow that ingests an API response, extracts it to a Table with a Smart Transform component, and then processes it through a Table Operations component

    If you want to use this example to test the Table Operations component, do the following:

    1. Create a flow with the following components:

      • API Request
      • Language Model
      • Smart Transform
      • Type Convert
    2. Configure the Smart Transform component and its dependencies:

      • API Request: Configure the API Request component to get JSON data from an endpoint of your choice, and then connect the API Response output to the Smart Transform component's Data input.
      • Language Model: Select your preferred provider and model, and then enter a valid API key. Change the output to Language Model, and then connect the LanguageModel output to the Smart Transform component's Language Model input.
      • Smart Transform: In the Instructions field, enter natural language instructions to extract data from the API response. Your instructions depend on the response content and desired outcome. For example, if the response contains a large result field, you might provide instructions like explode the result field out into a Data object.
    3. Convert the Smart Transform component's output from JSON to Table:

      1. Connect the Filtered Data output to the Type Convert component's JSON input.
      2. Set the Type Convert component's Output Type to Table.

    Now the flow is ready for you to add the Table Operations component.

  2. Add a Table Operations component to the flow, and then connect Table output from another component to the Table input.

    All operations in the Table Operations component require at least one Table input from another component. If a component doesn't produce Table output, you can use another component, such as the Type Convert component, to reformat the data before passing it to the Table Operations component. Alternatively, you could consider using a component that is designed to process the original data type, such as the Parser component or JSON Operations component.

    If you are following along with the example flow, connect the Type Convert component's Table Output port to the Table input.

  3. In the Operations field, select the operation you want to perform on the incoming Table. For example, the Filter operation filters the rows based on a specified column and value.

    tip

    You can select only one operation. If you need to perform multiple operations on the data, you can chain multiple Table Operations components together to execute each operation in sequence. For more complex multi-step operations, like dramatic schema changes or pivots, consider using an LLM-powered component, like the Structured Output component or Smart Transform component, as a replacement or preparation for the Table Operations component.

    If you're following along with the example flow, select any operation that you want to apply to the data that was extracted by the Smart Transform component. To view the contents of the incoming Table, click Run component on the Type Convert component, and then Inspect output. If the Table seems malformed, click Inspect output on each upstream component to determine where the error occurs, and then modify your flow's configuration as needed. For example, if the Smart Transform component didn't extract the expected fields, modify your instructions or verify that the given fields are present in the API Response output.

  4. Configure the operation's parameters. The specific parameters depend on the selected operation. For example, if you select the Filter operation, you must define a filter condition using the Column Name, Filter Value, and Filter Operator parameters. For more information, see Table Operations parameters

  5. To test the flow, click Run component on the Table Operations component, and then click Inspect output to view the new Table created from the Filter operation.

    If you want to view the output in the Playground, connect the Table Operations component's output to a Chat Output component, rerun the Table Operations component, and then click Playground.

For another example, see Conditional looping.

Table Operations parameters

Most Table Operations parameters are conditional because they only apply to specific operations.

The only permanent parameters are Table (df), which is the Table input, and Operation (operation), which is the operation to perform on the Table. Once you select an operation, the conditional parameters for that operation appear on the Table Operations component.

The Add Column operation allows you to add a new column to the Table with a constant value.

The parameters are New Column Name (new_column_name) and New Column Value (new_column_value).

Search