What is PandasAI?
PandasAI is a Python library that enables conversational data analysis over databases and datalakes using LLMs and RAG. It supports querying SQL, CSV, and Parquet sources through natural language prompts. The library requires Python 3.8+ up to 3.11 and an external LLM API key to function.
What are the features of PandasAI?
- Natural language data queryingAccepts text questions via the
df.chat()method and returns computed answers from loaded datasets. - Chart generationProduces visualizations such as histograms when users request plots in their natural language prompts.
- Multi-DataFrame analysisJoins and queries multiple DataFrames simultaneously by passing them into a single
pai.chat()call. - Docker sandbox executionRuns generated code inside an isolated Docker container to mitigate security risks from arbitrary execution.
- Flexible data loadingReads local CSV files using
pai.read_csv()or accepts dictionary-based DataFrame construction.
What are the use cases of PandasAI?
- Cross-table employee analysisQueries separate employee and salary DataFrames together to answer relational questions like identifying top earners.
- Regional sales reportingComputes aggregated metrics such as average revenue by region directly from a loaded CSV file.
How to use PandasAI?
- Install dependenciesRun
pip install pandasaiandpip install pandasai-litellmin a Python 3.8 to 3.11 environment. - Configure the LLMInitialize a LiteLLM instance with your model name and API key, then apply it using
pai.config.set(). - Load dataImport a dataset using
pai.read_csv()or construct a DataFrame from a dictionary. - Ask a questionPass a natural language prompt to the
df.chat()method and print the returned response.
PandasAI Pricing Information:
- Open-source libraryAvailable under the MIT expat license; requires users to supply their own LLM API keys.
- Enterprise offeringsManaged PandasAI Cloud and self-hosted enterprise options are available by contacting the vendor.









