(result)
| 346 | return _reconstruct(result) |
| 347 | |
| 348 | def _reconstruct(result): |
| 349 | if lib.is_scalar(result): |
| 350 | return result |
| 351 | |
| 352 | if result.ndim != self.ndim: |
| 353 | if method == "outer": |
| 354 | raise NotImplementedError |
| 355 | return result |
| 356 | if isinstance(result, BlockManager): |
| 357 | # we went through BlockManager.apply e.g. np.sqrt |
| 358 | result = self._constructor_from_mgr(result, axes=result.axes) |
| 359 | else: |
| 360 | # we converted an array, lost our axes |
| 361 | result = self._constructor( |
| 362 | result, **reconstruct_axes, **reconstruct_kwargs, copy=False |
| 363 | ) |
| 364 | # TODO: When we support multiple values in __finalize__, this |
| 365 | # should pass alignable to `__finalize__` instead of self. |
| 366 | # Then `np.add(a, b)` would consider attrs from both a and b |
| 367 | # when a and b are NDFrames. |
| 368 | if len(alignable) == 1: |
| 369 | result = result.__finalize__(self) |
| 370 | return result |
| 371 | |
| 372 | if "out" in kwargs: |
| 373 | # e.g. test_multiindex_get_loc |
no test coverage detected