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

Conversation

jbrockmendel
Copy link
Member

cc @jorisvandenbossche IIRC you didnt want to disallow SingleBlockManager because geopandas passes it. In those cases, does it also pass fastpath=True? If so, we can consider deprecating allowing SingleBlockManager in the non-fastpath case

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Apr 22, 2020

I am not fully sure anymore about the context where I would have said that (do you remember the issue/PR?)
In any case, geopandas handles the case where the data passed to the constructor is a SingleBlockManager. And it processes it like kind of a fastpath. But I think geopandas did that rather for compatibility with pandas passing such objects to the constructor, rather than geopandas wanting to pass block managers ourselves (need to check though).

But can you explain a bit in more detail what you propose to change or what you want to achieve? (I don't see much in the diff. You didn't yet change cases that are passing block managers to the constructor?)

@jbrockmendel
Copy link
Member Author

I am not fully sure anymore about the context where I would have said that (do you remember the issue/PR?)

I think it was in the PR where originally I wanted to make a _from_mgr fastpath, which ended up getting folded into __init__.

But can you explain a bit in more detail what you propose to change or what you want to achieve?

After this PR, the check if isinstance(data, SingleBlockManager) on L289 is never hit in the tests, so we could disallow it and simplify the constructor.

@jorisvandenbossche
Copy link
Member

After this PR, the check if isinstance(data, SingleBlockManager) on L289 is never hit in the tests, so we could disallow it and simplify the constructor.

But that's because the SingleBlockManager is also already handled at L206.
So you are only speaking about the case of passing SingleBlockManager + other keywords like index/dtype ? I think that is a good idea to disallow/deprecate that.

@@ -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

@jreback jreback added the Internals Related to non-user accessible pandas implementation label Apr 23, 2020
@jreback jreback added this to the 1.1 milestone Apr 23, 2020
@jreback jreback merged commit 4a5f9da into pandas-dev:master Apr 23, 2020
@jbrockmendel jbrockmendel deleted the fastpaths branch April 23, 2020 18:02
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants