Find answers from the community

Home
Members
vicevirus
v
vicevirus
Offline, last seen 6 months ago
Joined September 25, 2024
Might seem like a stupid question, but how do I not get the output in form of pandas instruction? Instead I want it in normal text form
Plain Text
import pandas as pd
# Assuming you have the llama_index package installed and properly set up
from llama_index.core.query_engine import PandasQueryEngine

from llama_index.core import PromptTemplate



df = pd.read_csv("./lessreal-data.csv", delimiter=';', skip_blank_lines=True)

# Initialize the query engine with the dataframe
query_engine = PandasQueryEngine(df=df, verbose=True)
prompts = query_engine.get_prompts()


new_prompt = PromptTemplate(
    """You will fetch me anime quotes from {query_str}"""
)
query_engine.update_prompts({"pandas_prompt": new_prompt})


# Perform a query to get a quote from Sena Kashiwazaki
response = query_engine.query(
    "Give me a quote from Tooi",
)

print(f"<b>{response}</b>")

Was looking at CSVReader on llamahub, but for some reason couldn't navigate and read the docs on it rn. Not sure if it's only me
9 comments
W
v