Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsAINetworkAirbyte Question AnsweringAmadeusAzure Cognitive ServicesClickUp Langchain ToolkitCSVDocument ComparisonGithubGitlabGmailGoogle Drive toolJiraJSONMultiOnOffice365OpenAPINatural Language APIsPandas DataframePlayWright BrowserPowerBI DatasetPythonSpark DataframeSpark SQLSQL DatabaseVectorstoreXorbitsMemoryCallbacksChat loadersComponentsAgents and toolkitsCSVOn this pageCSVThis notebook shows how to use agents to interact with data in CSV format. It is mostly optimized for question answering.NOTE: this agent calls the Pandas DataFrame agent under the hood, which in turn calls the Python agent, which executes LLM generated Python code - this can be bad if the LLM generated Python code is harmful. Use cautiously.from langchain.llms import OpenAIfrom langchain.chat_models import ChatOpenAIfrom langchain.agents.agent_types import AgentTypefrom langchain.agents import create_csv_agentUsing ZERO_SHOT_REACT_DESCRIPTION‚ÄãThis shows how to initialize the agent using the ZERO_SHOT_REACT_DESCRIPTION agent type. Note that this is an alternative to the above.agent = create_csv_agent(    OpenAI(temperature=0),    "titanic.csv",    verbose=True,    agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,)Using OpenAI Functions‚ÄãThis shows how to initialize the agent using the OPENAI_FUNCTIONS agent type. Note that this is an alternative to the above.agent = create_csv_agent(    ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613"),    "titanic.csv",    verbose=True,    agent_type=AgentType.OPENAI_FUNCTIONS,)agent.run("how many rows are there?")    Error in on_chain_start callback: 'name'        Invoking: `python_repl_ast` with `df.shape[0]`            891There are 891 rows in the
This notebook shows how to use agents to interact with data in CSV format. It is mostly optimized for question answering.
This notebook shows how to use agents to interact with data in CSV format. It is mostly optimized for question answering. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsAINetworkAirbyte Question AnsweringAmadeusAzure Cognitive ServicesClickUp Langchain ToolkitCSVDocument ComparisonGithubGitlabGmailGoogle Drive toolJiraJSONMultiOnOffice365OpenAPINatural Language APIsPandas DataframePlayWright BrowserPowerBI DatasetPythonSpark DataframeSpark SQLSQL DatabaseVectorstoreXorbitsMemoryCallbacksChat loadersComponentsAgents and toolkitsCSVOn this pageCSVThis notebook shows how to use agents to interact with data in CSV format. It is mostly optimized for question answering.NOTE: this agent calls the Pandas DataFrame agent under the hood, which in turn calls the Python agent, which executes LLM generated Python code - this can be bad if the LLM generated Python code is harmful. Use cautiously.from langchain.llms import OpenAIfrom langchain.chat_models import ChatOpenAIfrom langchain.agents.agent_types import AgentTypefrom langchain.agents import create_csv_agentUsing ZERO_SHOT_REACT_DESCRIPTION‚ÄãThis shows how to initialize the agent using the ZERO_SHOT_REACT_DESCRIPTION agent type. Note that this is an alternative to the above.agent = create_csv_agent(    OpenAI(temperature=0),    "titanic.csv",    verbose=True,    agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,)Using OpenAI Functions‚ÄãThis shows how to initialize the agent using the OPENAI_FUNCTIONS agent type. Note that this is an alternative to the above.agent = create_csv_agent(    ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613"),    "titanic.csv",    verbose=True,    agent_type=AgentType.OPENAI_FUNCTIONS,)agent.run("how many rows are there?")    Error in on_chain_start callback: 'name'        Invoking: `python_repl_ast` with `df.shape[0]`            891There are 891 rows in the