Skip to content

Conversation

@activenikhilg
Copy link
Contributor

Description: Added number_of_head_rows as a parameter to pandas agent. number_of_head_rows allows the user to select the number of rows to pass with the prompt when include_df_in_prompt is True. This gives the ability to control the token length and can be helpful in dealing with large dataframe.

Tag maintainer: @hinthornw @baskaryan

Twitter handle: @activenikhilg

number_of_head_rows allows the user to select the number of rows to pass with the prompt when include_df_in_prompt is True. This gives the ability to control the token length and can be helpful in dealing with large dataframe.
@vercel
Copy link

vercel bot commented Jul 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Jul 7, 2023 6:05am

@activenikhilg activenikhilg changed the title Added number_of_head_rows to parameters Added number_of_head_rows to pandas agent parameters Jul 6, 2023
suffix: Optional[str] = None,
input_variables: Optional[List[str]] = None,
include_df_in_prompt: Optional[bool] = True,
number_of_head_rows: Optional[int] = 5,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional means this can be None. is that actually true? or should this just be int

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be int. The default value for df.head() is 5 (df.head(x) returns x number of rows from the dataframe). So, this way if the value for number_of_head_rows is not passed, the function will perform as it performed earlier with default value. But with this addition, we can also change the value when required.

activenikhilg and others added 2 commits July 6, 2023 22:13
formatted with black
@baskaryan baskaryan merged commit 6095a0a into langchain-ai:master Jul 7, 2023
@activenikhilg activenikhilg deleted the activenikhilg-patch-pandas-agent branch July 7, 2023 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants