title: PySpark dataframe - How to pass string variable to df.where() condition
body: <p>I am not sure is this possible in pyspark. I believe it should be just that i am not winning here :(.</p>
  
  <p>Requirement:
  Bring any records whose FNAME and LNAME is null or 0</p>
  
  <p>Expected result:
  Top two rows as result.</p>
  
  <pre><code>df = sqlContext.read.format('com.databricks.spark.csv').options(header='true').load(fileName)
  df.show()
  
  +------+-------+------+
  | FNAME|  LNAME|  CITY|
  +------+-------+------+
  |     0|   null|    NY|
  |  null|      0|  null|
  |   Joe|   null|    LA|
  |  null|   Deon|    SA|
  | Steve|   Mark|  null|
  +------+-------+------+
  
  colCondition = []
  for col in df.columns:
      condition = '(df.'+col+'.isNull() | df.'+col+' == 0)'
      colCondition.append(condition)
  
  dfWhereConditon = ' &amp; '.join(colList)
  </code></pre>
  
  <p>This is what I want to achieve:</p>
  
  <pre><code>df.where(dfWhereConditon)
  </code></pre>
  
  <p>This does not work because dfWhereCondition is treated as string inside where condition. How can I solve this issue or is there a better way of achieving this.</p>
  
  <p>Thanks</p>