Adding code to allow pandas to show all columns instead of truncating… (#7901)

- Description: Adding code to set pandas dataframe to display all the
columns. Otherwise, some data get truncated (it puts a "..." in the
middle and just shows the first 4 and last 4 columns) and the LLM
doesn't realize it isn't getting the full data. Default value is 8, so
this helps Dataframes larger than that.
  - Issue: none
  - Dependencies: none
  - Tag maintainer: @hinthornw 
  - Twitter handle: none
pull/8007/head
eahova 1 year ago committed by GitHub
parent c416dbe8e0
commit aea97efe8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -118,6 +118,8 @@ def _get_prompt_and_tools(
) -> Tuple[BasePromptTemplate, List[PythonAstREPLTool]]:
try:
import pandas as pd
pd.set_option("display.max_columns", None)
except ImportError:
raise ValueError(
"pandas package not found, please install with `pip install pandas`"
@ -227,6 +229,8 @@ def _get_functions_prompt_and_tools(
) -> Tuple[BasePromptTemplate, List[PythonAstREPLTool]]:
try:
import pandas as pd
pd.set_option("display.max_columns", None)
except ImportError:
raise ValueError(
"pandas package not found, please install with `pip install pandas`"

Loading…
Cancel
Save