From 2c0a9eb70f612ccb2c712889945942d53013566c Mon Sep 17 00:00:00 2001 From: sichao Date: Fri, 19 Jan 2024 10:21:23 -0500 Subject: [PATCH] update the reference of pandas --- dynamo/preprocessing/normalization.py | 2 +- dynamo/tools/utils.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dynamo/preprocessing/normalization.py b/dynamo/preprocessing/normalization.py index f67d2a962..04dfa064a 100644 --- a/dynamo/preprocessing/normalization.py +++ b/dynamo/preprocessing/normalization.py @@ -186,7 +186,7 @@ def get_sz_exprs( szfactors = adata.obs[layer + "_Size_Factor"].values[:, None] if total_szfactor is not None and total_szfactor in adata.obs.keys(): - szfactors = adata.obs[total_szfactor][:, None] + szfactors = adata.obs[total_szfactor].values[:, None] elif total_szfactor is not None: main_warning("`total_szfactor` is not `None` and it is not in adata object.") except KeyError: diff --git a/dynamo/tools/utils.py b/dynamo/tools/utils.py index d26950fa0..5a2c33a37 100755 --- a/dynamo/tools/utils.py +++ b/dynamo/tools/utils.py @@ -1734,7 +1734,11 @@ def set_param_kinetic( ) = (None, None, None, None, None, None, None, None, None, None, None) if isarray(alpha) and alpha.ndim > 1: - params_df.loc[valid_ind, kin_param_pre + "alpha"] = alpha.mean(1) + params_df.loc[valid_ind, kin_param_pre + "alpha"] = ( + np.asarray(alpha.mean(1)) + if sp.issparse(alpha) + else alpha.mean(1) + ) cur_cells_ind, valid_ind_ = ( np.where(cur_cells_bools)[0][:, np.newaxis], np.where(valid_ind)[0],