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

alexander-ponomaroff
Copy link
Contributor

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

@codecov
Copy link

codecov bot 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
Copy link

codecov bot 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)
Copy link
Contributor

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

Copy link
Contributor

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]

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Feb 22, 2019
@jreback
Copy link
Contributor

jreback commented Mar 26, 2019

if you want to update to the suggestions above

@alexander-ponomaroff
Copy link
Contributor Author

@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
Copy link
Contributor

jreback 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
Labels
Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dropna(subset=...) does not accept incomplete key
2 participants