05. Data frame output parser (PandasDataFrameOutputParser)

PandasDataFrameOutputParser

Pandas DataFrame is a widely used data structure in the Python programming language, commonly used for data manipulation and analysis. It provides a comprehensive set of tools to cover structured data, which can be used in a variety of tasks such as data purification, conversion and analysis.

This output parser allows users to request an LLM that allows them to view data in formatted dictionary form by specifying any Pandas DataFrame and extracting data from that DataFrame.

Copy

from dotenv import load_dotenv

load_dotenv()

Copy

True

Copy

# Set up LangSmith tracking. https://smith.langchain.com
# !pip install langchain-teddynote
from langchain_teddynote import logging

# Enter a project name.
logging.langsmith("CH03-OutputParser")

Copy

 Start tracking LangSmith. 
[Project name] 
CH03-OutputParser 

Copy

Copy

format_parser_output Functions are used to convert parser output to preform and format output.

Copy

Copy

Copy

Copy

Copy

This is an example of looking at values for a column.

Copy

Copy

This is an example of searching for the first row.

Copy

Copy

An example of a task that searches for the average of some rows in a specific column.

Copy

Copy

Copy

Copy

Here is an example that calculates the average price for the rate (Fare).

Copy

Copy

Copy

Copy

Last updated