Skip to content

Commit

Permalink
Fixed to run prerank without error with rnk (type(pd.Series.name) == …
Browse files Browse the repository at this point in the history
…str)
  • Loading branch information
136s committed Dec 22, 2023
1 parent 0d2ec15 commit 6225fac
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions gseapy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,15 @@ def _load_data(self, exprs: Union[str, pd.Series, pd.DataFrame]) -> pd.DataFrame
elif isinstance(exprs, pd.Series):
# change to DataFrame
self._logger.debug("Input data is a Series with gene names")
if exprs.name is None:
# rename col if name attr is none
exprs.name = "sample1"
elif exprs.name.dtype != "O":
exprs.name = exprs.name.astype(str)
if not isinstance(exprs.name, str):
if exprs.name is None:
# rename col if name attr is none
exprs.name = "sample1"
elif hasattr(exprs.name, "dtype"):
if exprs.name.dtype != "O":
exprs.name = exprs.name.astype(str)
else:
exprs.name = str(exprs.name)
rank_metric = exprs.reset_index()
elif os.path.isfile(exprs):
rank_metric = self._read_file(exprs)
Expand Down

0 comments on commit 6225fac

Please sign in to comment.