Guys… going through the Data Analysis Course, and I believe there is a mistake in the exercises but wanted to make sure I wasn’t missing something about the any() command.
The challenge is to write a statement that’s True if any element is Zero, but the answer they give will actually return true if any element isn’t 0 I believe. Same problem in the Numpy exercise as well.
Below was my answer after some playing around with any, and I illustrated that the answer provided still shows True even when no element is 0.
So question is, am I missing something, or is the provided solution wrong? Also, I spent some time trying to figure out how I could use
X.any() to actually give the right answer, including
X.any(where=0) but couldn’t find a way, and all research showed answers for
np.any(), such as
np.any(X==0) which is basically my answer, but nothing for
np.array.any()… even numpys documents refer you to
np.any() when trying to research
np.array.any(). Is there a way to do it?
I’m probably digging way to much into what is really a non-issue, but once curiousity is peeked, not much I can do.