title: How to test if a column exists and is not null in a DataFrame
body: <p>I have a python RDD:</p>
  
  <pre><code>rddstats = rddstats.filter(lambda x : len(x) == NB_LINE or len(x) == NB2_LINE)
  </code></pre>
  
  <p>I created a dataframe based on this RDD:</p>
  
  <pre><code>logsDF = sqlContext.createDataFrame(rddstats,schema=["column1","column2","column3","column4","column5","column6","column7"])
  </code></pre>
  
  <p>I would like to do a test on the two <code>columns 6 and 7</code>:<br>
  if column 6 exists in the dataframe and not null I should return dataframe containing this value of the <code>column 6</code>, else I should return a dataframe that contains the value of the <code>column 7</code>. 
  This following my small code:</p>
  
  <pre><code>logsDF = sqlContext.createDataFrame(rddstats,schema=["column1","column2","column3","column4","column5","column6","column7"])
  if (logsDF['column6'] in rddstats and logsDF['column6'].isNotNull):
      logsDF.select("column1","column2","column3","column4","column5","column6")
  else:
      logsz84statsDF.select("column1","column2","column3","column4","column5","column7")
  </code></pre>
  
  <p>Is the syntax correct and have I the right to write in Python like this ?</p>