MCPcopy
hub / github.com/pandas-dev/pandas / _maybe_preserve_names

Method _maybe_preserve_names

pandas/core/indexes/multi.py:3201–3209  ·  view source on GitHub ↗
(self, target: IndexT, preserve_names: bool)

Source from the content-addressed store, hash-verified

3199 return target
3200
3201 def _maybe_preserve_names(self, target: IndexT, preserve_names: bool) -> IndexT:
3202 if (
3203 preserve_names
3204 and target.nlevels == self.nlevels
3205 and target.names != self.names
3206 ):
3207 target = target.copy(deep=False)
3208 target.names = self.names
3209 return target
3210
3211 # --------------------------------------------------------------------
3212 # Indexing Methods

Callers 1

_wrap_reindex_resultMethod · 0.95

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected