mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-13 08:27:03 +00:00
Revert "improve the performance of base.py" (#11143)
Reverts langchain-ai/langchain#8610 this is actually an oversight - this merges all dfs into one df. we DO NOT want to do this - the idea is we work and manipulate multiple dfs
This commit is contained in:
parent
9306394078
commit
258d67b0ac
@ -24,13 +24,11 @@ def create_csv_agent(
|
||||
if isinstance(path, (str, IOBase)):
|
||||
df = pd.read_csv(path, **_kwargs)
|
||||
elif isinstance(path, list):
|
||||
if not all(isinstance(item, (str, IOBase)) for item in path):
|
||||
raise ValueError(
|
||||
f"Expected all elements in the list to be strings, got {type(path)}."
|
||||
)
|
||||
dfs = [pd.read_csv(item, **_kwargs) for item in path]
|
||||
df = pd.concat(dfs, ignore_index=True)
|
||||
df = []
|
||||
for item in path:
|
||||
if not isinstance(item, (str, IOBase)):
|
||||
raise ValueError(f"Expected str or file-like object, got {type(path)}")
|
||||
df.append(pd.read_csv(item, **_kwargs))
|
||||
else:
|
||||
raise ValueError(f"Expected str or list, got {type(path)}")
|
||||
|
||||
raise ValueError(f"Expected str, list, or file-like object, got {type(path)}")
|
||||
return create_pandas_dataframe_agent(llm, df, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user