Hi,
I don’t understand why the provided answer for this section works. Here is the correct answer:
v_null = (mvc[v_col].isnull() & mvc[c_col].notnull()).sum()
c_null = (mvc[c_col].isnull() & mvc[v_col].notnull()).sum()
We were previously instructed that we needed to use parentheses around EACH element of complex Boolean comparison expressions, but this answer doesn’t do that. The components on each side of the ‘&’ are not individually wrapped in their own set of parentheses.
My original code, which did not work, looked like this:
v_null = mvc[(mvc[v_col].isnull()) & (mvc[c_col].notnull())].sum()
c_null = mvc[(mvc[v_col].notnull()) & (mvc[c_col].isnull())].sum()
Why did the correct answer work, even though it didn’t adhere to the formatting that has always been required in the past?
Why did my code not work?
Thank you!