> ## Documentation Index
> Fetch the complete documentation index at: https://docs.odella.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Analyze Table Block

> Leverage AI to analyze and transform tabular data based on natural language prompts

<Frame>
  <img src="https://mintcdn.com/odella/MNHyQg3-ZFMTYSp3/block-reference/assets/analyze_table_light.png?fit=max&auto=format&n=MNHyQg3-ZFMTYSp3&q=85&s=8c52ca003bd2d5cdcd62bfaee54f06cf" alt="Analyze Table Block Screenshot" className="block dark:hidden" width="686" height="340" data-path="block-reference/assets/analyze_table_light.png" />

  <img src="https://mintcdn.com/odella/MNHyQg3-ZFMTYSp3/block-reference/assets/analyze_table_dark.png?fit=max&auto=format&n=MNHyQg3-ZFMTYSp3&q=85&s=b16444d04e5d5b29ef456c6218f42a69" alt="Analyze Table Block Screenshot" className="hidden dark:block" width="718" height="398" data-path="block-reference/assets/analyze_table_dark.png" />
</Frame>

## Overview

The Analyze Table Block uses AI capabilities to perform complex analysis and transformations on tabular data. By providing a natural language prompt, you can instruct the AI to aggregate data, calculate summary statistics, or perform other sophisticated operations on your input table.

## Inputs

<ParamField path="Table" type="table" required>
  The input table to be analyzed. Should be an array of objects, where each object represents a row in the table.
</ParamField>

<ParamField path="Prompt" type="string" required>
  A natural language prompt describing the analysis or transformation to be performed on the table. This input is only available if "Use Prompt Input" is enabled in settings. The prompt guides the AI in generating the appropriate code for table analysis.
</ParamField>

## Outputs

<ResponseField name="Output" type="table">
  The resulting table after analysis or transformation. The structure of this table will depend on the operations specified in the prompt.
</ResponseField>

<ResponseField name="Duration" type="number">
  The time in milliseconds that the block took to execute.
</ResponseField>

## Editor Settings

<ParamField path="AI Model" type="string" default="default">
  The specific model to use for generating the analysis code. Available models are dynamically populated based on the LLM provider configuration.
</ParamField>

<ParamField path="Use Prompt Input" type="boolean" default={false}>
  When enabled, allows the prompt to be provided via an input port instead of being set in the settings.
</ParamField>

<ParamField path="Prompt" type="string">
  The analysis prompt to use when "Use Prompt Input" is disabled. Describe the analysis you would like to perform on the table. The AI will generate the code for you.
</ParamField>

## Requirements

* An LLM provider must be configured in the workflow context
* A code interpreter endpoint must be set in the settings (Azure Code Interpreter)

## Error Handling

The block will retry failed attempts up to 3 times with exponential backoff when encountering errors:

* Retries occur between 500ms and 5000ms apart
* Maximum of 3 retries before failing
* Error details are provided in the trace logs

Common errors include:

* Missing or invalid input table
* Failed code generation from AI
* Runtime errors in generated analysis code
* Missing configuration for LLM provider or code interpreter

<Warning>
  Always validate the output of the Analyze Table block, especially when working with critical data or making important decisions based on the results.
</Warning>

## Example Usage

1. Add an Analyze Table block to your flow
2. Connect your input table to the `Table` input
3. Either:
   * Enable "Use Prompt Input" and connect a prompt via the input port
   * Disable "Use Prompt Input" and enter your analysis prompt in settings
4. Select your desired AI model
5. Run the flow to get the analyzed table output

## FAQ

<AccordionGroup>
  <Accordion title="What types of analysis can the Analyze Table block perform?">
    The block can perform a wide range of operations using pandas, including: aggregations, filtering, sorting, pivoting, calculating summary statistics, and applying complex transformations. The capabilities are largely determined by the AI model's ability to generate appropriate pandas code.
  </Accordion>

  <Accordion title="How does the block handle date-time data?">
    The block automatically handles messy date-time formats in the input data, converting them to appropriate pandas datetime objects for analysis.
  </Accordion>

  <Accordion title="How is the analysis performed securely?">
    The analysis code is executed in an isolated Azure Code Interpreter environment. The data is processed securely within this environment and only the results are returned.
  </Accordion>
</AccordionGroup>

## See Also

* [AI Filter Block](/block-reference/ai/ai-filter)
* [Ask AI Block](/block-reference/ai/ai)
* [Table Block](/block-reference/loaders/read-table)
