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

dropna(subset=...) should accept incomplete key #25407

Closed

Conversation

Projects
None yet
2 participants
@alexander-ponomaroff
Copy link
Contributor

commented Feb 22, 2019

I'm not sure if this is the best way to go about solving this problem, so feedback would be appreciated.

  • closes #17737
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

alexander-ponomaroff added some commits Feb 22, 2019

@codecov

This comment has been minimized.

Copy link

commented Feb 22, 2019

Codecov Report

Merging #25407 into master will decrease coverage by <.01%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.29% <71.42%> (-0.01%) ⬇️
#single 41.72% <14.28%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/frame.py 96.77% <71.42%> (-0.11%) ⬇️
pandas/util/testing.py 87.66% <0%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c0f6a8...56c5d97. Read the comment docs.

1 similar comment
@codecov

This comment has been minimized.

Copy link

commented Feb 22, 2019

Codecov Report

Merging #25407 into master will decrease coverage by <.01%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.29% <71.42%> (-0.01%) ⬇️
#single 41.72% <14.28%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/frame.py 96.77% <71.42%> (-0.11%) ⬇️
pandas/util/testing.py 87.66% <0%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c0f6a8...56c5d97. Read the comment docs.

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)

This comment has been minimized.

Copy link
@jreback

jreback Feb 22, 2019

Contributor

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

This comment has been minimized.

Copy link
@jreback

jreback Feb 22, 2019

Contributor

though you may not need to do any of this, just

agg_obj = self.loc(axis=axis)[subset]

This comment has been minimized.

Copy link
@alexander-ponomaroff

alexander-ponomaroff Feb 25, 2019

Author Contributor

Thank you for the feedback, I will take a look. Sorry for the late reply.

This comment has been minimized.

Copy link
@alexander-ponomaroff

alexander-ponomaroff Mar 1, 2019

Author Contributor

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

@jreback jreback added the Indexing label Feb 22, 2019

@jreback

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

if you want to update to the suggestions above

@alexander-ponomaroff

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2019

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

@jreback

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2019

closing as to the current solution. if you can make this work can reopen.

@jreback jreback closed this Apr 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.