Skip to content

Commit

Permalink
Remove pandas imports (#40)
Browse files Browse the repository at this point in the history
* remove these silly imports, its finally cleansed
* update docstring
  • Loading branch information
jkanche authored Sep 22, 2023
1 parent daca714 commit 4d629cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
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

0 comments on commit 4d629cc

Please sign in to comment.