From 726edf1821dc8e6d9fd1c7b889a7ef6f5b001dd8 Mon Sep 17 00:00:00 2001 From: Darien Schettler <50381286+darien-schettler@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:54:15 -0500 Subject: [PATCH] Update dataframe.py Simplify lazy load in dataframe document loader. --- .../langchain_community/document_loaders/dataframe.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/community/langchain_community/document_loaders/dataframe.py b/libs/community/langchain_community/document_loaders/dataframe.py index 1b508533f8d93..74ad56b53f783 100644 --- a/libs/community/langchain_community/document_loaders/dataframe.py +++ b/libs/community/langchain_community/document_loaders/dataframe.py @@ -21,9 +21,8 @@ def lazy_load(self) -> Iterator[Document]: """Lazy load records from dataframe.""" for _, row in self.data_frame.iterrows(): - text = row[self.page_content_column] metadata = row.to_dict() - metadata.pop(self.page_content_column) + text = metadata.pop(self.page_content_column) yield Document(page_content=text, metadata=metadata)