Skip to content

How can I provide context about my pandas dataset to Llamaindex? #14754

Answered by dosubot bot
mraguth asked this question in Q&A
Discussion options

You must be logged in to vote

To provide context about your pandas dataset to Llamaindex so that it can refer to your data attributes in a meaningful way, you can customize the DEFAULT_PANDAS_TMPL template. Here is an example of how you can modify the template to refer to 'EmpID' as 'Employee Number':

from llama_index.core.prompts import PromptTemplate, PromptType

############################################
# Pandas
############################################

CUSTOM_PANDAS_TMPL = (
    "You are working with a pandas dataframe in Python.\n"
    "The name of the dataframe is `df`.\n"
    "This is the result of `print(df.head())`:\n"
    "{df_str}\n\n"
    "Please note the following context about the dataframe columns:

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mraguth
Comment options

@dosubot
Comment options

Answer selected by mraguth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant