Skip to content

Commit 61f35d2

Browse files
committed
fixup! names_make_unique(): remove superfluous index assignment
1 parent 6cb3be5 commit 61f35d2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/mudata/_core/mudata.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,14 @@ def _names_make_unique(self, attr: Literal["obs", "var"]):
874874

875875
mod_sum = np.sum([a.shape[axis] for a in self._mod.values()])
876876
if mod_sum != self.shape[axis]:
877-
self._update_attr(attr, axis=axis)
877+
self._update_attr(attr, axis=axis) # global names set by update
878+
else:
879+
attrval = getattr(self, attr)
880+
881+
# self._set_names replaces the names of each modality. Unnecessary here, since the names are coming directly from the modalities
882+
attrval.index = pd.Index([], name=attrval.index.name).append(
883+
[getattr(mod, namesattr) for mod in self._mod.values()]
884+
)
878885

879886
def obs_names_make_unique(self):
880887
"""

0 commit comments

Comments
 (0)