title: Linq Lambda Averaging of DataTable Columns - removing 0 values
body: <p>I am averaging each column in a DataTable and adding those averages to a list.  How can I prevent the average from including values of 0?  I've tried the code below but get an error that the operator <code>!=</code>can not be applied to operands of type <code>object[]</code> and <code>int</code></p>
  
  <pre><code>for (int col = 5; col &lt; DT2.Columns.Count; col++)
  {
      double avg = DT2.AsEnumerable()
                   .Where(x =&gt; 
                       x[DT2.Columns[col]] != DBNull.Value || 
                       x[DT2.Rows[col].ItemArray != 0)
                   .Average(x =&gt; double.Parse(x[DT2.Columns[col]].ToString()));
      averages.Add(avg);
  }
  </code></pre>
  
  <p>Im starting with col = 5 because I only want to average every column after the fifth column. The data in the columns being averaged is of type double. If I remove the code where Im attempting to remove values of 0, the code runs but if for example I average the first column and the column has 10 rows but 3 of them contain 0, it will add all the rows together and divide by 10 where as I need it to divide by 7</p>