-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: drop_level argument for xs #4180
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
Conversation
oh dear, screwed something up in this, need to fix. |
@hayd should be marked for 0.13? |
@jreback merge? or do you have a better arg name? |
hmmm.....and we don't want to make could we do this thru
? |
This makes xs more like a filter (atm the behaviour is to drop the selected level, this adds option not too). |
this is adding a modification option what about adding |
ah ok, yeah drop_level is better |
Hmmm giving def _drop_levels a drop_level was stupid, this is a bad way to do this. Need to reconsider. |
no...I meant in core/generic.py make a method called |
ah, true and this isn't really a cross section either... I dunno actually I think this makes sense as an option for xs...just viewing the data in slightly different way, with superfluous index level. I guess you can hack select to do this:
Maybe could just add this api to select? (add level argument)
looks to see if crit is callable, if is current behaviour, if not then looks at level whatever and does xs without dropping level (the result we're talking about). |
would shy away from select, its a linear search...let's go back to xs... how about ''drop=...'' ? (rather than |
I liked you drop_level (as a compromise :p), I think it's clearer what you're dropping then. Ok, have to clean up this code though, it looks like I just threw this together without thinking about back-end semantics. I think it's much easier than my awful hack. |
@jreback logic is now much improved. |
looks good.. |
As discussed here, xs usually remove the level which you are accessing. This commit allows you to explicitly say you don't want that (and want to keep the same levels in the result).