This device is not compatible.


Query CSV Files with Natural Language Using LangChain and Panel

In this project, we will learn to build a Panel application with LangChain, where users can query and analyze tabular datasets through natural language.

Query CSV Files with Natural Language Using LangChain and Panel

You will learn to:

Create a web application using HoloViz Panel.

Plot custom scatter plots using Plotly.

Work with CSV files.

Create DataFrame agents that analyze tabular data to answer queries in natural language.


Large Language Models (LLMs)

Natural Language Processing

API Integration

Data Visualization


Intermediate programming skills with Python

Basic knowledge of working with large language models

Basic knowledge of LangChain framework


Panel logo




HoloViz logo


LangChain logo


Project Description

The LangChain library provides pandas DataFrame agents that can be used to analyze data in a CSV file. These agents work by using large language models such as GPT-3 to first logically deduce what is required, then use that information to write code that achieves the purpose using the LLM, and finally run the code to get an observation. This cycle can repeat several times until the required answer is achieved.

In this project, we will use the Python Panel library to create an interactive dashboard that can be used to analyze any CSV file that is uploaded to it. The following components will be available on the web page:

  • A file upload widget that can be used to upload any CSV file.

  • A chat box for interacting with the agent.

  • An interactive table that shows the data present in the CSV file.

  • A Plotly scatter plot that can be used to visualize relations between any two features with respect to the target class.

The complete dashboard can be seen in the figure below:

The complete web application
The complete web application

Project Tasks



Task 0: Get Started

Task 1: Load the Libraries


The Panel Web Application

Task 2: The Initialization Method

Task 3: Load the Page Components

Task 4: Construct the Web Application's Frontend

Task 5: Create Custom Plots

Task 6: Upload New CSV File

Task 7: Run the Agent