Skip to content

REF: avoid passing SingleBlockManager to Series #33727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need the fastpath arg?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to go through the fastpath, yes. getting rid of the fastpath entirely is a separate topic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

)
for idx, item in enumerate(self.columns)
}

Expand Down
4 changes: 1 addition & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 2 additions & 5 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down