title: PySpark error: TypeError: Invalid argument, not a string or column
body: <p>I am trying to calculate the similarity between all of the two possible pairs of words from a column in a Spark data frame. I have created a UDF as well as a data frame to test the function, which I have defined them as follow:</p>
  <pre><code>   #Similarity Function
  def lcs_similarityy(vector):
    metric_lcs = MetricLCS()
    p = []
    for i in vector:
      for j in vector:
        p.append(1 - metric_lcs.distance(i, j))
    return  p
     
     #UDF
  lcs_similarityyUDF = udf(lambda z: lcs_similarityy(z))
  
     #Spark Data Frame
  df = spark.createDataFrame([&quot;GERMAN&quot;, &quot;GERMANIA&quot;, &quot;GERMANY&quot;, &quot;LENOVO&quot;], &quot;string&quot;).toDF(&quot;Name&quot;)
  
  </code></pre>
  <p>I am expecting a column of 16 rows since there are 16 possible posible pairs. However once I test the function</p>
  <pre><code>lcs_similarityUDF(df.select(&quot;Name&quot;))
  
  </code></pre>
  <p>I am given the error:</p>
  <pre><code>
  TypeError: Invalid argument, not a string or column: DataFrame[Name: string] of type &lt;class 'pyspark.sql.dataframe.DataFrame'&gt;. For column literals, use 'lit', 'array', 'struct' or 'create_map' function.
  
  </code></pre>
  <p>I´ve been trying to fix this problem through different approaches but I cant make it work and I know very little about Spark and what could it be the problem. I dont know if I´ve made a mistake in the UDF or definig the data frame some any help with this is greatly appreciated.</p>