title: PySpark: TypeError: 'str' object is not callable in dataframe operations
body: <p>I am reading files from a folder in a loop and creating dataframes from these.
  However, I am getting this weird error <code>TypeError: 'str' object is not callable</code>.
  Please find the code here:</p>
  
  <pre><code>for yr in range (2014,2018):
    cat_bank_yr = sqlCtx.read.csv(cat_bank_path+str(yr)+'_'+h1+'bank.csv000',sep='|',schema=schema)
    cat_bank_yr=cat_bank_yr.withColumn("cat_ledger",trim(lower(col("cat_ledger"))))
    cat_bank_yr=cat_bank_yr.withColumn("category",trim(lower(col("category"))))
  </code></pre>
  
  <p>The code runs for one iteration and then stops at the line  </p>
  
  <pre><code>cat_bank_yr=cat_bank_yr.withColumn("cat_ledger",trim(lower(col("cat_ledger")))) 
  </code></pre>
  
  <p>with the above error.</p>
  
  <p>Can anyone help out?</p>