You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pandas.testing.assert_series_equal precision defaults changed in pandas 1.1.0 #1018
I think maybe the best way to fix this is to wrap the pandas functions with our own with some version-checking logic. Or we could rework all the failing tests to use more precise values, or bump the minimum pandas version to 1.1.0, neither of which seems like a good option to me.
Oh boy. I think that we should eventually rework the tests to use the new atol and rtol arguments but that's no small effort. We could override the defaults with less precise tolerances. And prohibit pandas >=1.1.0 until that work is done.
It's definitely not a small effort but I'm guessing that doing it right the first time will be better in the long run. This is going to be with us for a couple of years.
I'm -1 on prohibiting the latest pandas for something that only effects the test suite.
This appears to get all but a handful of the tests passing with pandas 1.1.0:
frompkg_resourcesimportparse_versiondef_check_pandas_assert_kwargs(kwargs):
ifparse_version(pd.__version__) >=parse_version('1.1.0'):
# 1e-3 and 1e-5 roughly approximate the behavior of check_less_preciseifkwargs.pop('check_less_precise', False):
kwargs['atol'] =1e-3kwargs['rtol'] =1e-3else:
kwargs['atol'] =1e-5kwargs['rtol'] =1e-5else:
kwargs.pop('rtol', None)
kwargs.pop('atol', None)
returnkwargsdefassert_series_equal(left, right, **kwargs):
kwargs=_check_pandas_assert_kwargs(kwargs)
pd.testing.assert_series_equal(left, right, **kwargs)
# and similarly for the two other assert functions
It's definitely not a small effort but I'm guessing that doing it right the first time will be better in the long run. This is going to be with us for a couple of years.
Could you expand on what "doing it right" means? I'm not sure whether this refers to reworking the tests to use more precise expected values or to specify appropriate rtol/atol for each test, or perhaps something else.
I think there are only three tests* that don't pass with this function, all of which have fairly large error between the actual and expected values. If I've bisected the git history correctly, it was the "disable perez enhancement" PR that introduced the difference, but the test precisions were lowered rather than changing the expected values: https://github.com/pvlib/pvlib-python/pull/459/files#diff-1cade70498bbcfab4710eb31ae0c9e21R424-R481
I'd say let's just update the expected values for those three tests -- no need to preserve that difference, right? If so I'll open a PR with those values updated and the above function implemented and we'll see what Azure thinks about it.
*gremlins are preventing me from running the bifacial tests at the moment, so not sure about them
Activity
cwhanse commentedon Aug 4, 2020
Oh boy. I think that we should eventually rework the tests to use the new
atolandrtolarguments but that's no small effort. We could override the defaults with less precise tolerances. And prohibit pandas >=1.1.0 until that work is done.wholmgren commentedon Aug 4, 2020
I agree. It sounds doable with something like
and similar for assert_frame_equal.
It's definitely not a small effort but I'm guessing that doing it right the first time will be better in the long run. This is going to be with us for a couple of years.
I'm -1 on prohibiting the latest pandas for something that only effects the test suite.
cwhanse commentedon Aug 4, 2020
I am OK with this, thanks for explaining with the example.
kandersolar commentedon Aug 6, 2020
This appears to get all but a handful of the tests passing with pandas 1.1.0:
Could you expand on what "doing it right" means? I'm not sure whether this refers to reworking the tests to use more precise expected values or to specify appropriate rtol/atol for each test, or perhaps something else.
wholmgren commentedon Aug 6, 2020
@kanderso-nrel looks good!
I think there are a few tests that specify a different tolerance. We could change them or we could make your function a little more flexible.
kandersolar commentedon Aug 7, 2020
I think there are only three tests* that don't pass with this function, all of which have fairly large error between the actual and expected values. If I've bisected the git history correctly, it was the "disable perez enhancement" PR that introduced the difference, but the test precisions were lowered rather than changing the expected values: https://github.com/pvlib/pvlib-python/pull/459/files#diff-1cade70498bbcfab4710eb31ae0c9e21R424-R481
I'd say let's just update the expected values for those three tests -- no need to preserve that difference, right? If so I'll open a PR with those values updated and the above function implemented and we'll see what Azure thinks about it.
*gremlins are preventing me from running the bifacial tests at the moment, so not sure about them
wholmgren commentedon Aug 7, 2020
Right. Fine with me if the tests are
assert ac.iloc[0] > 0; assert ac.iloc[1] <= 0- model chain tests don't need precision.