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

Method _constructor_from_mgr

pandas/core/frame.py:667–682  ·  view source on GitHub ↗
(self, mgr, axes)

Source from the content-addressed store, hash-verified

665 return DataFrame
666
667 def _constructor_from_mgr(self, mgr, axes) -> DataFrame:
668 df = DataFrame._from_mgr(mgr, axes=axes)
669
670 if type(self) is DataFrame:
671 # This would also work `if self._constructor is DataFrame`, but
672 # this check is slightly faster, benefiting the most-common case.
673 return df
674
675 elif type(self).__name__ == "GeoDataFrame":
676 # Shim until geopandas can override their _constructor_from_mgr
677 # bc they have different behavior for Managers than for DataFrames
678 return self._constructor(mgr)
679
680 # We assume that the subclass __init__ knows how to handle a
681 # pd.DataFrame object.
682 return self._constructor(df)
683
684 _constructor_sliced: Callable[..., Series] = Series
685

Callers 12

_get_values_for_csvMethod · 0.95
select_dtypesMethod · 0.95
shiftMethod · 0.95
isnaMethod · 0.95
sort_valuesMethod · 0.95
_dispatch_frame_opMethod · 0.95
diffMethod · 0.95
roundMethod · 0.95
quantileMethod · 0.95
isinMethod · 0.95
_to_dict_of_blocksMethod · 0.95
_reduceMethod · 0.45

Calls 2

_constructorMethod · 0.95
_from_mgrMethod · 0.80

Tested by

no test coverage detected