diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 6c3523f830e97..5defb8916c73f 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3649,7 +3649,9 @@ def reindexer(value): @property def _series(self): return { - item: Series(self._mgr.iget(idx), index=self.index, name=item) + item: Series( + self._mgr.iget(idx), index=self.index, name=item, fastpath=True + ) for idx, item in enumerate(self.columns) } diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 2f35a5b6f9a7e..b2ed47465e395 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -11208,9 +11208,7 @@ def block_accum_func(blk_values): result = self._mgr.apply(block_accum_func) - d = self._construct_axes_dict() - d["copy"] = False - return self._constructor(result, **d).__finalize__(self, method=name) + return self._constructor(result).__finalize__(self, method=name) return set_function_name(cum_func, name, cls) diff --git a/pandas/core/series.py b/pandas/core/series.py index 9ef865a964123..f990cc7ae7917 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -259,12 +259,8 @@ def __init__( # astype copies data = data.astype(dtype) else: - # need to copy to avoid aliasing issues + # GH#24096 we need to ensure the index remains immutable data = data._values.copy() - if isinstance(data, ABCDatetimeIndex) and data.tz is not None: - # GH#24096 need copy to be deep for datetime64tz case - # TODO: See if we can avoid these copies - data = data._values.copy(deep=True) copy = False elif isinstance(data, np.ndarray): @@ -281,6 +277,7 @@ def __init__( index = data.index else: data = data.reindex(index, copy=copy) + copy = False data = data._mgr elif is_dict_like(data): data, index = self._init_dict(data, index, dtype)