Skip to content

CLN: tighten Exception catching in indexing.py #29305

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 5 commits into from
Nov 3, 2019

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Oct 31, 2019

get rid of is_lexsorted_for_tuple while we're at it

@gfyoung gfyoung added Clean Indexing Related to indexing on series/frames, not to indexes themselves labels Oct 31, 2019
@gfyoung
Copy link
Member

gfyoung commented Oct 31, 2019

Are exceptions simply being handled more specifically now?

Or are they be handled higher up in the stack now?

@@ -93,7 +93,6 @@ Compatibility with MultiIndex
:toctree: api/

Index.set_names
Index.is_lexsorted_for_tuple
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned a few lines above, this is apparently for compatibility with MultiIndex. That is no longer needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

is_lexsorted_for_tuple is used in only one place (deleted by this PR), is not overriden by MultiIndex, and always returns True. It is no longer needed.

Copy link
Member

Choose a reason for hiding this comment

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

It is not needed by pandas maybe, but it is part of the public API (to make the API of Index and MultiIndex more alike)

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think its a big deal to remove this method. Could have a note about it I guess.

Copy link
Member

Choose a reason for hiding this comment

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

It was added before to have consistent methods between Index and MultiIndex. Should we then remove it from MultiIndex as well?

To be clear: I don't care about this specific method, it's probably not used much. But we did add other methods to the Index API just to make it easier to have code that works for both index and multi-index. So just wondering why that wouldn't be the case here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we then remove it from MultiIndex as well?

It is not overridden by MultiIndex

Copy link
Member

Choose a reason for hiding this comment

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

It is not overridden by MultiIndex

That's not my point. What I am trying to say is: in the past, we tried to keep a consistent api between Index / MultiIndex. So why not do that here?(either keep both, or remove both)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm definitely confused. If this PR is merged, then there will be no is_lexsorted_for_tuple on any class. Which should classify as "remove both", shouldn't it?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I mis-interpreted your "this is not overriden". I was only thinking about the implications for the user (the fact that it is overriden or not does not necessarily mean this method was not there for API compatibility), but of course that means you also removed the method for MultiIndex. So fine with this!

@jorisvandenbossche
Copy link
Member

Echoing @gfyoung's question, it would be helpful if you add some explanation why you are removing / changing things in your PRs.

@jreback jreback added this to the 1.0 milestone Oct 31, 2019
@jreback
Copy link
Contributor

jreback commented Oct 31, 2019

lgtm.

@jbrockmendel
Copy link
Member Author

Are exceptions simply being handled more specifically now? Or are they be handled higher up in the stack now?

They are no longer reached. AFAICT this is leftover from Panel indexing

@jreback
Copy link
Contributor

jreback commented Nov 2, 2019

can you add a whatsnew note, technically this was public api; ping on green.

@jbrockmendel
Copy link
Member Author

ping

@jorisvandenbossche jorisvandenbossche merged commit 28c9ccc into pandas-dev:master Nov 3, 2019
@jbrockmendel jbrockmendel deleted the faster-index branch November 3, 2019 21:42
Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants