title: Assign value to specific cell in PySpark dataFrame
body: <p>I want to change a value in a specific cell of my <code>Spark DataFrame</code> using <code>PySpark</code>.</p>
  
  <p>Trivial example - I create a mock <code>Spark DataFrame</code>:</p>
  
  <pre><code>df = spark.createDataFrame(
      [
       (1, 1.87, 'new_york'), 
       (4, 2.76, 'la'), 
       (6, 3.3, 'boston'), 
       (8, 4.1, 'detroit'), 
       (2, 5.70, 'miami'), 
       (3, 6.320, 'atlanta'), 
       (1, 6.1, 'houston')
      ],
      ('variable_1', "variable_2", "variable_3")
  )
  </code></pre>
  
  <p>Runnning <code>display(df)</code> I get this table:</p>
  
  <pre><code>variable_1   variable_2   variable_3
      1           1.87    new_york
      4           2.76    la
      6           3.3     boston
      8           4.1     detroit
      2           5.7     miami
      3           6.32    atlanta
      1           6.1     houston
  </code></pre>
  
  <p>Let´s say for example, I would like to assign a new value for the cell in the 4th row and 3rd column, i.e. changing <code>detroit</code> for <code>new_orleans</code>. I know assignments as <code>df.iloc[4, 3] = 'new_orleans'</code> or <code>df.loc[4, 'detroit'] = 'new_orleans'</code> are not valid in <code>Spark</code>. </p>
  
  <p>A valid answer to my question using <code>when</code> would be:</p>
  
  <pre><code>from pyspark.sql.functions import when
  targetDf = df.withColumn("variable_3", \
                when(((df["variable_1"] == 8) &amp; (df["variable_2"] == 4.1)) , 'new_orleans').otherwise(df["variable_3"]))
  </code></pre>
  
  <p>My question is: could this be done in a more practical way in <code>PySpark</code> without the necessity of entering all the values and column names of the row where I want to change just 1 single cell (maybe achieving the same without using the <code>when</code> function)?</p>
  
  <p>Thanks in advance for your help and @useruser9806664 for his feedback.</p>