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

Method wrap_results_for_axis

pandas/core/apply.py:1443–1462  ·  view source on GitHub ↗

return the results for the columns

(
        self, results: ResType, res_index: Index
    )

Source from the content-addressed store, hash-verified

1441 return self.columns
1442
1443 def wrap_results_for_axis(
1444 self, results: ResType, res_index: Index
1445 ) -> DataFrame | Series:
1446 """return the results for the columns"""
1447 result: DataFrame | Series
1448
1449 # we have requested to expand
1450 if self.result_type == "expand":
1451 result = self.infer_to_same_shape(results, res_index)
1452
1453 # we have a non-series and don't want inference
1454 elif not isinstance(results[0], ABCSeries):
1455 result = self.obj._constructor_sliced(results)
1456 result.index = res_index
1457
1458 # we may want to infer results
1459 else:
1460 result = self.infer_to_same_shape(results, res_index)
1461
1462 return result
1463
1464 def infer_to_same_shape(self, results: ResType, res_index: Index) -> DataFrame:
1465 """infer the results to the same shape as the input object"""

Callers

nothing calls this directly

Calls 2

infer_to_same_shapeMethod · 0.95
_constructor_slicedMethod · 0.45

Tested by

no test coverage detected