Skip to content
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

REF: remove BlockManager.set #33347

Merged
merged 14 commits into from
Apr 17, 2020
Merged

REF: remove BlockManager.set #33347

merged 14 commits into from
Apr 17, 2020

Conversation

jbrockmendel
Copy link
Member

xref #33052, #33332.

This touches several DataFrame/NDFrame methods. Those methods need a refactor in part because the ones defined on NDFrame are only ever called for DataFrame. Will refactor in follow-up.

@@ -3210,7 +3210,7 @@ def _maybe_cache_changed(self, item, value) -> None:
"""
The object has called back to us saying maybe it has changed.
"""
self._mgr.set(item, value)
NDFrame._set_item(self, item, value, clear=False)
Copy link
Member

Choose a reason for hiding this comment

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

for my edification, why NDFrame?

Copy link
Member Author

Choose a reason for hiding this comment

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

because we dont want to go through the DataFrame._set_item method

Copy link
Member

Choose a reason for hiding this comment

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

are double underscore methods appropriate here for intraclass method calls? https://docs.python.org/3/tutorial/classes.html?highlight=mangle#private-variables

@jbrockmendel jbrockmendel added Internals Related to non-user accessible pandas implementation Refactor Internal refactoring of code labels Apr 9, 2020
@jreback jreback added this to the 1.1 milestone Apr 9, 2020
@@ -3589,13 +3589,20 @@ def _slice(self: FrameOrSeries, slobj: slice, axis=0) -> FrameOrSeries:
result._set_is_copy(self, copy=is_copy)
return result

def _iset_item(self, loc: int, value) -> None:
def _iset_item(self, loc: int, value, clear: bool_t = True) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

where do we not clear?

Copy link
Member Author

Choose a reason for hiding this comment

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

we get here via NDFrame._maybe_cache_changed.

These are pretty spaghetti-ish, looking forward to cleaning them out

@jbrockmendel
Copy link
Member Author

updated to remove the need for clear kwarg, so we end up not needing to touch DataFrame methods at all

@jreback jreback merged commit ab9f3c9 into pandas-dev:master Apr 17, 2020
@jreback
Copy link
Contributor

jreback commented Apr 17, 2020

thanks!

@jbrockmendel jbrockmendel deleted the mgr-set branch April 17, 2020 22:12
CloseChoice pushed a commit to CloseChoice/pandas that referenced this pull request Apr 20, 2020
rhshadrach pushed a commit to rhshadrach/pandas that referenced this pull request May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internals Related to non-user accessible pandas implementation Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants