Skip to content

Commit

Permalink
rm pandas dependency (langchain-ai#2102)
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchase17 authored Mar 28, 2023
1 parent 410bf37 commit f281033
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 56 deletions.
12 changes: 8 additions & 4 deletions langchain/document_loaders/dataframe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Load from Dataframe object"""
from typing import List

import pandas as pd
from typing import Any, List

from langchain.docstore.document import Document
from langchain.document_loaders.base import BaseLoader
Expand All @@ -10,8 +8,14 @@
class DataFrameLoader(BaseLoader):
"""Load Pandas DataFrames."""

def __init__(self, data_frame: pd.DataFrame, page_content_column: str = "text"):
def __init__(self, data_frame: Any, page_content_column: str = "text"):
"""Initialize with dataframe object."""
import pandas as pd

if not isinstance(data_frame, pd.DataFrame):
raise ValueError(
f"Expected data_frame to be a pd.DataFrame, got {type(data_frame)}"
)
self.data_frame = data_frame
self.page_content_column = page_content_column

Expand Down
53 changes: 2 additions & 51 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ SQLAlchemy = "^1"
requests = "^2"
PyYAML = ">=5.4.1"
numpy = "^1"
pandas = ">=1.5.3"
faiss-cpu = {version = "^1", optional = true}
wikipedia = {version = "^1", optional = true}
elasticsearch = {version = "^8", optional = true}
Expand Down

0 comments on commit f281033

Please sign in to comment.