Open antonykamp opened 5 years ago
Interesting, that does sound like something was changed upstream. Perhaps we could also consider changing it to something like:
if variance is not None:
return np.sqrt(variance)
else:
return None
To prevent this problem from reoccurring. I wouldn't mind if you made this small change already in #268, since it does not affect the tests themselves.
Herzliche Grüße
Hey, the small change doesn't affect the results, but your solution is a quite more elegant one than mine :D I'm going to change this quickly.
return variance and np.sqrt(variance)
should also work (iff variance != 0), but you do lose some interpretability.
try:
return np.sqrt(variance)
except (TypeError, AttributeError):
return None
would be the more elegant try/except version.
I had this for the first time, but the solution by @tBuLi was more readable for me.
Hey,
working on the conversion of the tests (#268), I got test failures because of the functions variance and stdev.
Because variance is returning a NoneType object, the function stdev can't pull the root. There is a try-except block already, so the only thing to do is adding 'TypeError'. Maybe the numpy dev changed the exception from AttributeError. to TypeError.
If that's so simple, I would do this with #268.
Grüße