Skip to content

Commit

Permalink
Merge pull request zqfang#240 from 136s/master
Browse files Browse the repository at this point in the history
Fixed to run prerank without error with rnk (type(pd.Series.name) == str)
  • Loading branch information
zqfang authored Dec 22, 2023
2 parents 0d2ec15 + 6225fac commit 2b95ff5
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 2b95ff5

Please sign in to comment.