Skip to main content

PandasAI

Beyond querying, PandasAI offers functionalities to visualize data through graphs, cleanse datasets by addressing missing values, and enhance data quality through feature generation, making it a comprehensive tool for data scientists and analysts.

Features

  • Natural language querying: Ask questions to your data in natural language.
  • Data visualization: Generate graphs and charts to visualize your data.
  • Data cleansing: Cleanse datasets by addressing missing values.
  • Feature generation: Enhance data quality through feature generation.
  • Data connectors: Connect to various data sources like CSV, XLSX, PostgreSQL, MySQL, BigQuery, Databricks, Snowflake, etc.

How does PandasAI work?

PandasAI uses generative AI models to understand and interpret natural language queries and translate them into python code and SQL queries. It then uses the code to interact with the data and return the results to the user.

Who should use PandasAI?

PandasAI is designed for business analysts, data scientists, and engineers who want to interact with their data in a more natural way. It is particularly useful for those who are not familiar with SQL or Python or who want to save time and effort when working with data. It is also useful for those who are familiar with SQL and Python, as it allows them to ask questions to their data without having to write any complex code.

How to get started with PandasAI?

PandasAI is available as a Python library. You can install the library using pip or poetry and use it in your Python code.

📚 Using the library

The PandasAI library provides a Python interface for interacting with your data in natural language. You can use it to ask questions to your data, generate graphs and charts, cleanse datasets, and enhance data quality through feature generation. It uses LLMs to understand and interpret natural language queries and translate them into python code and SQL queries. Once you have installed pandasai, simply import it and use it to ask questions to your data.
import pandasai as pai
from pandasai_litellm.litellm import LiteLLM

# Initialize LiteLLM with your OpenAI model
llm = LiteLLM(model="gpt-4.1-mini", api_key="YOUR_OPENAI_API_KEY")

# Configure PandasAI to use this LLM
pai.config.set({
    "llm": llm
})

# Load your data
df = pai.read_csv("data/companies.csv")

response = df.chat("What is the average revenue by region?")
print(response)

Support

If you have any questions or need help, please join our discord server.

License

PandasAI is available under the MIT expat license, except for the pandasai/ee directory, which has its license here if applicable. If you are interested in the Enterprise License, see Enterprise Features or visit pandas-ai.com.

Analytics

We’ve partnered with Scarf to collect anonymized user statistics to understand which features our community is using and how to prioritize product decision-making in the future. To opt out of this data collection, you can set the environment variable SCARF_NO_ANALYTICS=true.
⌘I