-
-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
Fixed assertion error message #5242
Conversation
thanks! |
did you actually see this error? how? |
@jtratner It came up as part of a traceback in some code I was debugging... Was a pretty weird error to try to make sense of:
Err... Yeah? ;) |
@ojh can you post code that generated it? maybe need a test for it...... |
The reason we're asking is because if you see an AssertionError, the logic |
@jreback @jtratner Sorry for the slow response, it was late when I posted this last night, and I've been busy all morning today... The code I was dealing with is a bit hairy, but the following should illustrate the issue clearly enough: import numpy, pandas
rng = pandas.date_range('1/1/2011', periods=72, freq='H')
ts = pandas.Series(numpy.random.randn(len(rng)), index=rng)
ts.truncate(before='10/31/2011', after='12/31/2011') # No problem here
ts.truncate(before='12/31/2011', after='10/31/2011') # Switched dates, to illustrate That last line then throws the following error (which is pretty much what I would expect, except that the order of the dates is wrong in the message):
The author of the actual code which resulted in this had assumed that the dates he was reading in would always be in chronological order - turns out this wasn't the case in one particular CSV file that got imported... Obviously, this has now been fixed with an appropriate failsafe added. I fully agree that users should never see assertion errors, but the confusing error message made the issue harder to debug for me, so I figured it might save someone else the confusion in future. |
Thanks - that's helpful |
This is a pretty straightforward fix, message was simply inverted.