title: Python to return dataframe values masked before NaN
body: <p>I am trying to work on a requirement where I am computing the Zscore and want to compare with individual values in the rows. If Zscore&gt;1 , I mark them as <code>NaN</code> for those specific values. I am marking it as <code>NaN</code>, so that I could fill those values by appropriate techniques and then I also want to return a dataframe which would tell me what were the original NaN values.</p>
  <p>I have the below code:</p>
  <pre><code>s={'2014':[1,1,2,2],'2015':[12,22,33,44],'2016':[55,66,77,88],'2017':[2,3,4,5]}
  p=pd.DataFrame(data=s)
  
       2014 2015 2016 2017
     0    1   12  55   2
     1    1   22  66   3
     2    2   33  77   4
     3    2   44  88   5
  </code></pre>
  <p>I have computed zscore as -</p>
  <pre><code>df_zscore = (p - p.mean())/p.std()
  
         2014       2015        2016       2017
  0   -0.866025   -1.139879   -1.161895   -1.161895
  1   -0.866025   -0.416146   -0.387298   -0.387298
  2   0.866025    0.379960    0.387298    0.387298
  3   0.866025    1.176065    1.161895    1.161895
  
  
  out = p.mask(df_zscore &gt; 1)
  </code></pre>
  <p>If Zscore&gt;1, then the output comes like this-</p>
  <pre><code>       2014       2015        2016       2017
  0      1          12          55         2
  1      1          22          66         3
  2      2          33          77         4
  3      2          NaN         NaN       NaN
  </code></pre>
  <p>(They are marked as NaN, since Zscore was &gt;1)</p>
  <p>I want to write a code, which would basically do a tracking of values, i.e. values that were not NaN, but became NaN due to Zscore limit, so ideally I should get the below dataframe.</p>
  <p>Desired O/P-</p>
  <pre><code>   2015       2016       2017
  3    44       88          5
  </code></pre>
  <p>How would I be able to do this?</p>
  <p>I know since my dataset is small, I can easily figure this out by just looking at the data, but what about when the dataset is huge, that's when I really need to see it.</p>