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.
from dotenv import load_dotenv
load_dotenv()True# 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") Start tracking LangSmith.
[Project name]
CH03-OutputParser import pprint
from typing import Any, Dict
import pandas as pd
from langchain.output_parsers import PandasDataFrameOutputParser
from langchain_core.prompts import PromptTemplate
from langchain_openai import ChatOpenAIformat_parser_output Functions are used to convert parser output to preform and format output.
This is an example of looking at values for a column.
This is an example of searching for the first row.
An example of a task that searches for the average of some rows in a specific column.
Here is an example that calculates the average price for the rate (Fare).
Last updated