title: Count substring in string column using Spark dataframe
body: <p>I have a Spark dataframe with a column (<code>assigned_products</code>) of type string that contains values such as the following:</p>
  <pre><code>&quot;POWER BI PRO+Power BI (free)+AUDIO CONFERENCING+OFFICE 365 ENTERPRISE E5 WITHOUT AUDIO CONFERENCING&quot;
  </code></pre>
  <p>I would like to count the occurrences of <code>+</code> in the string for and return that value in a new column.</p>
  <p>I tried the following, but I keep returning errors.</p>
  <pre><code>from pyspark.sql.functions import col
  
  DF.withColumn('Number_Products_Assigned', col(&quot;assigned_products&quot;).count(&quot;+&quot;))
  </code></pre>
  <p>I'm running my code in Azure Databricks on a cluster running Apache Spark 2.3.1.</p>