-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
BUG: reindex with empty inputs #27326
Conversation
…uring an unaffecting task
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.
pls always add tests
find the reindex tests; we need to run all combinations of args for an empty |
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. |
@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. |
@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 |
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.
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: |
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.
use not len
@ajspera is this still active? |
closing as stale; this does fix the issue but needs tests. if you want to continue, pls merge master and ping to re-open. |
…seless in that case anyway
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff