Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove pandas imports #40

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/biocframe/BiocFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
from .types import SlicerArgTypes, SlicerTypes
from .utils import _match_to_indices, _slice_or_index

try:
from pandas import DataFrame
except ImportError:
pass

__author__ = "jkanche"
__copyright__ = "jkanche"
__license__ = "MIT"
Expand Down Expand Up @@ -649,8 +644,8 @@ def __iter__(self) -> BiocFrameIter:
"""Iterator over rows."""
return BiocFrameIter(self)

def to_pandas(self) -> DataFrame:
"""Convert :py:class:`~biocframe.BiocFrame.BiocFrame` to a :py:class:`~pandas.DataFrame` object.
def to_pandas(self):
"""Convert :py:class:`~biocframe.BiocFrame.BiocFrame` into :py:class:`~pandas.DataFrame` object.

Returns:
DataFrame: A :py:class:`~pandas.DataFrame` object.
Expand Down
9 changes: 2 additions & 7 deletions src/biocframe/io/from_pandas.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from ..BiocFrame import BiocFrame

try:
from pandas import DataFrame
except ImportError:
pass

__author__ = "jkanche"
__copyright__ = "jkanche"
__license__ = "MIT"


def from_pandas(input: "DataFrame") -> BiocFrame:
def from_pandas(input) -> BiocFrame:
"""Read a :py:class:`~biocframe.BiocFrame.BiocFrame` from a :py:class:`~pandas.DataFrame` object.

Args:
Expand All @@ -26,7 +21,7 @@ def from_pandas(input: "DataFrame") -> BiocFrame:
from pandas import DataFrame

if not isinstance(input, DataFrame):
raise TypeError("data is not a pandas `DataFrame` object.")
raise TypeError("`data` is not a pandas `DataFrame` object.")

rdata = input.to_dict("list")
rindex = None
Expand Down