title: How to combine array columns which have Nan values?
body: <p>i'm a beginner in python and I have some problems with combining data.</p>
  
  <p>What I want to do is deal with my data, completely discarding columns that have Nan values.</p>
  
  <p>But the indices of Nan values are different in most of my data.</p>
  
  <p>For example,</p>
  
  <pre><code>data1 = np.array([1, 2, np.nan, 4, 5])
  data2 = np.array([1, np.nan, 3, 4, 6])
  data3 = np.array([np.nan, 2, 3, 4, 7])
  
  ind_1 = np.where(~np.isnan(data1))
  ind_2 = np.where(~np.isnan(data2))
  ind_3 = np.where(~np.isnan(data3))
  
  -----
  
  data1_out = data1[ind_1[0]]  # array([ 1., 2., 4., 5.])
  data2_out = data2[ind_2[0]]  # array([ 1., 3., 4., 6.])
  data3_out = data3[ind_3[0]]  # array([ 2., 3., 4., 7.])
  </code></pre>
  
  <p>but what i need is an arrays like</p>
  
  <pre><code>data1_out = array([ 4., 5.])
  data2_out = array([ 4., 6.])
  data3_out = array([ 4., 7.])
  </code></pre>
  
  <p>So I think the combined array like</p>
  
  <pre><code>ind_c = intersection(ind_1, ind_2, ind_3)
  data1_out = data1[ind_c[0]]
  </code></pre>
  
  <p>would solve the problem!</p>
  
  <p>which is shared output with others, so if the index of one data set has Nan value, it influence all same index of other data set.</p>
  
  <p>I can't find a simple way to do this. Any advise?</p>