Skip to content

BUG: reindex with empty inputs #27326

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

ajspera
Copy link

@ajspera ajspera commented Jul 10, 2019

…seless in that case anyway

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

pls always add tests

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves labels Jul 10, 2019
@jreback jreback changed the title Resolve #27315 - prevent contextually useless kwargs from causing an index error BUG: reindex with empty inputs Jul 10, 2019
@jreback
Copy link
Contributor

jreback commented Jul 10, 2019

find the reindex tests; we need to run all combinations of args for an empty

@ajspera
Copy link
Author

ajspera commented Jul 10, 2019

Will do when I find some more time this week... New to the python world and this project so I need a few more moments to get familiar with the testing.

@ajspera
Copy link
Author

ajspera commented Jul 16, 2019

@jreback, could the tests be a while loop on a dict list using **kwargs on the method or are you looking for explicit individual tests for each arg combination? The former makes sense to me for efficiency, but being relatively new to python projects I'm not sure whether that overly obfuscates failure messages. Also I noticed the entry point on reindex tests are not on the class where I discovered the issue or even in the stack trace of those errors, and the class that I changed is further down inheritance of the tested class in there. Should we write tests for higher level DataFrame.reindex or should we go for the lowest public granularity of where (assuming private methods are not test targets like other languages) the changes are at Index.reindex? I can see reasons for either decision based on skimming through the class inheritance patterns.

Sorry if these are remedial questions, just want to make my limited time focused and productive while reducing review cycle tedium for you where my knowledge gaps are. I'll make decisions once I get into it either way if there's no preference, but some foresight would save some time if there are preferences.

Also sorry for the delay, too many commitments on my plate at the moment. Next step for this is to get a list of args for the test which is simple but tedious enough to conflict my schedule. If anyone wants to assist I can probably fit resolving any test failures into my schedule easier. If nobody claims that testing task I will wrap this up as soon as I can.

@WillAyd
Copy link
Member

WillAyd commented Aug 26, 2019

@ajspera you should be able to parametrize the various combinations of parameters. If you search for parametrize in the tests you should see quite a few examples to work off of

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

needs a test & a whatsnew note

@@ -3062,6 +3062,9 @@ def _get_nearest_indexer(self, target, limit, tolerance):
values that can be subtracted from each other (e.g., not strings or
tuples).
"""
if len(self) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

use not len

@WillAyd
Copy link
Member

WillAyd commented Sep 13, 2019

@ajspera is this still active?

@jreback
Copy link
Contributor

jreback commented Oct 6, 2019

closing as stale; this does fix the issue but needs tests. if you want to continue, pls merge master and ping to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

some argument combinations with reindex fails on an empty dataframe
3 participants