Great software, want a try! An error when running wilcox_results
Artery = cell_metadata.index[cell_metadata['louvain'] == '9']
Vein = cell_metadata.index[cell_metadata['louvain'] == '6']
reaction_consistencies = get_reaction_consistencies(reaction_penalties)
wilcox_results = wilcoxon_test(reaction_consistencies, Artery, Vein)
wilcox_results['metadata_r_id'] = ""
for r in wilcox_results.index:
if r in reaction_metadata.index:
wilcox_results.loc[r, 'metadata_r_id'] = r
elif r[:-4] in reaction_metadata.index:
wilcox_results.loc[r, 'metadata_r_id'] = r[:-4]
else:
print("Should not occur")
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-117-e65f78c64525> in <module>
----> 1 wilcox_results = wilcoxon_test(reaction_consistencies, Artery, Vein)
2 wilcox_results['metadata_r_id'] = ""
3 for r in wilcox_results.index:
4 if r in reaction_metadata.index:
5 wilcox_results.loc[r, 'metadata_r_id'] = r
<ipython-input-4-6134c7613f6f> in wilcoxon_test(consistencies_matrix, group_A_cells, group_B_cells)
4 """
5 #per reaction/meta-reaction, conduct wilcoxon test between group_A and group_B
----> 6 group_A = consistencies_matrix.loc[:,group_A_cells]
7 group_B = consistencies_matrix.loc[:,group_B_cells]
8 results = pd.DataFrame(index = consistencies_matrix.index, columns = ['wilcox_stat', 'wilcox_pval', 'cohens_d'], dtype='float64')
~/miniconda3/envs/compass/lib/python3.6/site-packages/pandas/core/indexing.py in __getitem__(self, key)
871 # AttributeError for IntervalTree get_value
872 pass
--> 873 return self._getitem_tuple(key)
874 else:
875 # we by definition only have the 0th axis
~/miniconda3/envs/compass/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup)
1053 return self._multi_take(tup)
1054
-> 1055 return self._getitem_tuple_same_dim(tup)
1056
1057 def _get_label(self, label, axis: int):
~/miniconda3/envs/compass/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_tuple_same_dim(self, tup)
748 continue
749
--> 750 retval = getattr(retval, self.name)._getitem_axis(key, axis=i)
751 # We should never have retval.ndim < self.ndim, as that should
752 # be handled by the _getitem_lowerdim call above.
~/miniconda3/envs/compass/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1097 raise ValueError("Cannot index with multidimensional key")
1098
-> 1099 return self._getitem_iterable(key, axis=axis)
1100
1101 # nested tuple slicing
~/miniconda3/envs/compass/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_iterable(self, key, axis)
1035
1036 # A collection of keys
-> 1037 keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
1038 return self.obj._reindex_with_indexers(
1039 {axis: [keyarr, indexer]}, copy=True, allow_dups=True
~/miniconda3/envs/compass/lib/python3.6/site-packages/pandas/core/indexing.py in _get_listlike_indexer(self, key, axis, raise_missing)
1252 keyarr, indexer, new_indexer = ax._reindex_non_unique(keyarr)
1253
-> 1254 self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
1255 return keyarr, indexer
1256
~/miniconda3/envs/compass/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis, raise_missing)
1314 with option_context("display.max_seq_items", 10, "display.width", 80):
1315 raise KeyError(
-> 1316 "Passing list-likes to .loc or [] with any missing labels "
1317 "is no longer supported. "
1318 f"The following labels were missing: {not_found}. "
KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported. The following labels were missing: Index(['CTCTCGAGTCAGTTTG', 'TTTATGCAGGGTTAAT'], dtype='object'). See [https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike%22)
Great software, want a try! An error when running wilcox_results
when I see Artery