Here are some examples of how to use PandasAI. More examples are included in the repository along with samples of data.
Using PandasAI with a Pandas DataFrame
Example of using PandasAI with a CSV file
Example of using PandasAI with an Excel file. In order to use Excel files as a data source, you need to install the pandasai[excel]
extra dependency.
Then, you can use PandasAI with an Excel file as follows:
Example of using PandasAI with a Parquet file
Example of using PandasAI with a Google Sheet. In order to use Google Sheets as a data source, you need to install the pandasai[google-sheet]
extra dependency.
Then, you can use PandasAI with a Google Sheet as follows:
Remember that at the moment, you need to make sure that the Google Sheet is public.
Example of using PandasAI with a Modin DataFrame. In order to use Modin dataframes as a data source, you need to install the pandasai[modin]
extra dependency.
Then, you can use PandasAI with a Modin DataFrame as follows:
Example of using PandasAI with a Polars DataFrame (still in beta). In order to use Polars dataframes as a data source, you need to install the pandasai[polars]
extra dependency.
Then, you can use PandasAI with a Polars DataFrame as follows:
Example of using PandasAI to plot a chart from a Pandas DataFrame
You can pass a custom path to save the charts. The path must be a valid global path. Below is the example to Save Charts with user defined location.
Example of using PandasAI with multiple dataframes. In order to use multiple dataframes as a data source, you need to use a SmartDatalake
instead of a SmartDataframe
. You can instantiate a SmartDatalake
as follows:
With the chat agent, you can engage in dynamic conversations where the agent retains context throughout the discussion. This enables you to have more interactive and meaningful exchanges.
Key Features
Context Retention: The agent remembers the conversation history, allowing for seamless, context-aware interactions.
Clarification Questions: You can use the clarification_questions
method to request clarification on any aspect of the conversation. This helps ensure you fully understand the information provided.
Explanation: The explain
method is available to obtain detailed explanations of how the agent arrived at a particular solution or response. It offers transparency and insights into the agent’s decision-making process.
Feel free to initiate conversations, seek clarifications, and explore explanations to enhance your interactions with the chat agent!
When you instantiate an agent, you can provide a description of the agent. THis description will be used to describe the agent in the chat and to provide more context for the LLM about how to respond to queries.
Some examples of descriptions can be:
You can add customs functions for the agent to use, allowing the agent to expand its capabilities. These custom functions can be seamlessly integrated with the agent’s skills, enabling a wide range of user-defined operations.
Here are some examples of how to use PandasAI. More examples are included in the repository along with samples of data.
Using PandasAI with a Pandas DataFrame
Example of using PandasAI with a CSV file
Example of using PandasAI with an Excel file. In order to use Excel files as a data source, you need to install the pandasai[excel]
extra dependency.
Then, you can use PandasAI with an Excel file as follows:
Example of using PandasAI with a Parquet file
Example of using PandasAI with a Google Sheet. In order to use Google Sheets as a data source, you need to install the pandasai[google-sheet]
extra dependency.
Then, you can use PandasAI with a Google Sheet as follows:
Remember that at the moment, you need to make sure that the Google Sheet is public.
Example of using PandasAI with a Modin DataFrame. In order to use Modin dataframes as a data source, you need to install the pandasai[modin]
extra dependency.
Then, you can use PandasAI with a Modin DataFrame as follows:
Example of using PandasAI with a Polars DataFrame (still in beta). In order to use Polars dataframes as a data source, you need to install the pandasai[polars]
extra dependency.
Then, you can use PandasAI with a Polars DataFrame as follows:
Example of using PandasAI to plot a chart from a Pandas DataFrame
You can pass a custom path to save the charts. The path must be a valid global path. Below is the example to Save Charts with user defined location.
Example of using PandasAI with multiple dataframes. In order to use multiple dataframes as a data source, you need to use a SmartDatalake
instead of a SmartDataframe
. You can instantiate a SmartDatalake
as follows:
With the chat agent, you can engage in dynamic conversations where the agent retains context throughout the discussion. This enables you to have more interactive and meaningful exchanges.
Key Features
Context Retention: The agent remembers the conversation history, allowing for seamless, context-aware interactions.
Clarification Questions: You can use the clarification_questions
method to request clarification on any aspect of the conversation. This helps ensure you fully understand the information provided.
Explanation: The explain
method is available to obtain detailed explanations of how the agent arrived at a particular solution or response. It offers transparency and insights into the agent’s decision-making process.
Feel free to initiate conversations, seek clarifications, and explore explanations to enhance your interactions with the chat agent!
When you instantiate an agent, you can provide a description of the agent. THis description will be used to describe the agent in the chat and to provide more context for the LLM about how to respond to queries.
Some examples of descriptions can be:
You can add customs functions for the agent to use, allowing the agent to expand its capabilities. These custom functions can be seamlessly integrated with the agent’s skills, enabling a wide range of user-defined operations.