Screen Link: https://app.dataquest.io/m/370/working-with-missing-data/3/filling-and-verifying-the-killed-and-injured-data
My Code:
injured.iloc[3] = injured.iloc[3].mask(injured.iloc[3] != injured_manual_sum, np.nan)
What I expected to happen:
the ‘total_injured’ series, where the values that were not identical to the ‘injured_manual_sum’ values, would be replaced with a null value.
What actually happened:
ValueError: Can only compare identically-labeled Series objects
this code works as expected when I replace injured.iloc[3]
with injured['total_injured']
even if only inside the Series.mask() method. I thought that those two names are just different ways to call the same series and should be interchangeable. Is there something else that I am missing? Thanks!