CSV/Excel Analysis Agent
Author: Hye-yoon Jeong
Peer Review:
Proofread : BokyungisaGod
This is a part of LangChain Open Tutorial
Overview
This tutorial covers how to create an agent that performs analysis on the Pandas DataFrame loaded from CSV or Excel files. The agent generates Pandas queries to analyze the dataset.
Table of Contents
References
Environment Setup
Set up the environment. You may refer to Environment Setup for more details.
[Note]
langchain-opentutorialis a package that provides a set of easy-to-use environment setup, useful functions and utilities for tutorials.You can check out the
langchain-opentutorialfor more details.
Sample Data
Document Used for Practice : Titanic Dataset
File Name : titanic.csv
Link : Stanford CS109 Material
Please copy the downloaded file to the data folder for practice.
0
0
3
Mr. Owen Harris Braund
male
22.0
1
0
7.2500
1
1
1
Mrs. John Bradley (Florence Briggs Thayer) Cum...
female
38.0
1
0
71.2833
2
1
3
Miss. Laina Heikkinen
female
26.0
0
0
7.9250
3
1
1
Mrs. Jacques Heath (Lily May Peel) Futrelle
female
35.0
1
0
53.1000
4
0
3
Mr. William Henry Allen
male
35.0
0
0
8.0500
Create an Analysis Agent
Define an agent to analyze the data loaded from CSV or Excel files using create_pandas_dataframe_agent .
This agent needs a PythonAstREPLTool to execute Python codes. Also, a custom function is defined to print the intermediate steps of the agent execution.








Last updated