Skip to content

Commit 9bb63c2

Browse files
authored
Merge pull request #197 from d33bs/master
Improve Memory Performance Within merge_single_cells
2 parents 02d0522 + 4e53eed commit 9bb63c2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pycytominer/cyto_utils/cells.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,13 @@ def merge_single_cells(
713713

714714
sc_df = (
715715
self.image_df.merge(sc_df, on=self.merge_cols, how="right")
716-
.rename(self.linking_col_rename, axis="columns")
717-
.rename(self.full_merge_suffix_rename, axis="columns")
716+
# pandas rename performance may be improved using copy=False, inplace=False
717+
# reference: https://ryanlstevens.github.io/2022-05-06-pandasColumnRenaming/
718+
.rename(
719+
self.linking_col_rename, axis="columns", copy=False, inplace=False
720+
).rename(
721+
self.full_merge_suffix_rename, axis="columns", copy=False, inplace=False
722+
)
718723
)
719724
if single_cell_normalize:
720725
# Infering features is tricky with non-canonical data

0 commit comments

Comments
 (0)