Skip to content

Commit

Permalink
Merge pull request #197 from d33bs/master
Browse files Browse the repository at this point in the history
Improve Memory Performance Within merge_single_cells
  • Loading branch information
gwaybio authored Jun 17, 2022
2 parents 02d0522 + 4e53eed commit 9bb63c2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pycytominer/cyto_utils/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,13 @@ def merge_single_cells(

sc_df = (
self.image_df.merge(sc_df, on=self.merge_cols, how="right")
.rename(self.linking_col_rename, axis="columns")
.rename(self.full_merge_suffix_rename, axis="columns")
# pandas rename performance may be improved using copy=False, inplace=False
# reference: https://ryanlstevens.github.io/2022-05-06-pandasColumnRenaming/
.rename(
self.linking_col_rename, axis="columns", copy=False, inplace=False
).rename(
self.full_merge_suffix_rename, axis="columns", copy=False, inplace=False
)
)
if single_cell_normalize:
# Infering features is tricky with non-canonical data
Expand Down

0 comments on commit 9bb63c2

Please sign in to comment.