Building a Conversational Data Analysis App with Streamlit and PandasAI (Chat with your DataFrames!)

Hey Streamlit Community,

I wanted to share a YouTube video tutorial in Spanish but dubbed in English, thanks to YouTube. The project I built using Streamlit adds a powerful capability for data analysis: natural language querying via PandasAI.

PandasAI acts as an AI agent for your DataFrames, allowing users (even non-technical ones!) to ask questions about their data in plain English (or other languages) and get results back as DataFrames, charts, or simple text.

I created a Streamlit app demonstrating this by:

  • Allowing CSV/Excel file uploads.

  • Converting the uploaded data into a PandasAI DataFrame.

  • Setting up a chat interface using st.chat_input and st.chat_message.

  • Showing how PandasAI handles queries and returns results (including generated code and charts).

  • Integrating with different LLMs (like Mistral in this example) using litellm.

This is a fantastic way to make your data applications more interactive and accessible.

You can see a demo and walk-through in this video:

1 Like

(post deleted by author)

Hello, I think you can try with this code from the docs GitHub - sinaptik-ai/pandas-ai: Chat with your database or your datalake (SQL, CSV, parquet). PandasAI makes data analysis conversational using LLMs and RAG.

import pandasai as pai
from pandasai_openai.openai import OpenAI

llm = OpenAI("OPEN_AI_API_KEY")

pai.config.set({
    "llm": llm
})

I hope it helps.

Regards

1 Like