Try to find common names to attach to the result of an operation between a and b. Return a consensus list of names if they match at least partly or list of None if they have completely different names.
(self, other)
| 4300 | return self.copy(deep=False) |
| 4301 | |
| 4302 | def _maybe_match_names(self, other): |
| 4303 | """ |
| 4304 | Try to find common names to attach to the result of an operation between |
| 4305 | a and b. Return a consensus list of names if they match at least partly |
| 4306 | or list of None if they have completely different names. |
| 4307 | """ |
| 4308 | if len(self.names) != len(other.names): |
| 4309 | return [None] * len(self.names) |
| 4310 | names = [] |
| 4311 | for a_name, b_name in zip(self.names, other.names, strict=True): |
| 4312 | if a_name == b_name: |
| 4313 | names.append(a_name) |
| 4314 | else: |
| 4315 | # TODO: what if they both have np.nan for their names? |
| 4316 | names.append(None) |
| 4317 | return names |
| 4318 | |
| 4319 | def _wrap_intersection_result(self, other, result) -> MultiIndex: |
| 4320 | _, result_names = self._convert_can_do_setop(other) |