Skip to content

Commit

Permalink
Merge pull request #21 from klarman-cell-observatory/boli
Browse files Browse the repository at this point in the history
Updated
  • Loading branch information
bli25 committed Jun 9, 2020
2 parents 6a16ef5 + 8d31f23 commit 83e034b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion pegasusio/aggr_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ def _get_fillna_dict(self, df: pd.DataFrame) -> dict:
""" Generate a fillna dict for columns in a df """
fillna_dict = {}
for column in df:
fillna_dict[column] = "" if df[column].dtype.kind in {"O", "S"} else 0
if df[column].dtype.kind == "b":
fillna_dict[column] = False
elif df[column].dtpye.kind in {"i", "u", "f", "c"}:
fillna_dict[column] = 0
elif df[column].dtype.kind == "S":
fillna_dict[column] = b""
elif df[column].dtype.kind in {"O", "U"}:
fillna_dict[column] = ""
else:
raise ValueError(f"{column} has unsupported dtype {df[column].dtype}!")

return fillna_dict


Expand Down
4 changes: 2 additions & 2 deletions pegasusio/readwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def read_input(
black_list: Set[str] = None,
select_data: Set[str] = None,
select_genome: Set[str] = None,
select_modality: Set[str] = None,
select_modality: Set[str] = None,
) -> MultimodalData:
"""Load data into memory.
Expand Down Expand Up @@ -164,7 +164,7 @@ def read_input(

data.subset_data(select_data, select_genome, select_modality)
data.kick_start()
data.scan_black_list(black_list)
data.scan_black_list(black_list)

logger.info(f"{file_type} file '{input_file}' is loaded.")

Expand Down

0 comments on commit 83e034b

Please sign in to comment.