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
dropna(subset=...) should accept incomplete key #25407
dropna(subset=...) should accept incomplete key #25407
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25407 +/- ##
==========================================
- Coverage 91.73% 91.73% -0.01%
==========================================
Files 173 173
Lines 52845 52852 +7
==========================================
+ Hits 48479 48485 +6
- Misses 4366 4367 +1
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #25407 +/- ##
==========================================
- Coverage 91.73% 91.73% -0.01%
==========================================
Files 173 173
Lines 52845 52852 +7
==========================================
+ Hits 48479 48485 +6
- Misses 4366 4367 +1
Continue to review full report at Codecov.
|
if (len(subset[0]) < ax.nlevels and | ||
isinstance(subset[0], tuple)): | ||
for _ in range(ax.nlevels - len(subset[0])): | ||
ax = ax.droplevel(ax.nlevels - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be able to just change this to .get_loc
and it should work; the return value can be different though
In [1]: mi = pd.MultiIndex.from_product([list('abc'), list(range(3))])
In [2]: mi.get_loc('a')
Out[2]: slice(0, 3, None)
In [3]: i = pd.Index(range(3))
In [4]: i.get_loc(2)
Out[4]: 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though you may not need to do any of this, just
agg_obj = self.loc(axis=axis)[subset]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback, I will take a look. Sorry for the late reply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback I've been trying to play around with what you suggested, but so far I cannot get it to work. I will keep trying, but wanted to ask if you have any further suggestions?
if you want to update to the suggestions above |
@jreback When I attempted to implement the requested changes above, I couldn't get it to work. I will give it another shot within the next few days and will let you know if I can get it to work. |
closing as to the current solution. if you can make this work can reopen. |
I'm not sure if this is the best way to go about solving this problem, so feedback would be appreciated.
git diff upstream/master -u -- "*.py" | flake8 --diff