title: How can I add a row or replace in a specific index in Pyspark Dataframe?
body: <p>I want to add this list L1 as a row in the first index, How to append a row in a specific index in Pyspark Dataframe?</p>
  <pre class="lang-py prettyprint-override"><code>L1=['na',5.6,2.4]
  
  data=[('fr',8.8,6.6),
        ('nr',4.4,2.5),
        ('cc',2.3,3.9)]
  data_schema=[StructField('loc',StringType(),True),StructField('col',FloatType(),True),StructField('io',FloatType(),True)]
  final=StructType(fields=data_schema)
  
  
  df=spark.createDataFrame(data,schema=final)
  
  df=df.withColumn(&quot;idx&quot;, F.row_number().over(Window.orderBy('col'))) 
  
  &gt;&gt;show
  +---+----+---+---+
  |loc| col| io|idx|
  +---+----+---+---+
  | fr| 8.8|6.6|  1|
  | nr| 4.4|2.5|  2|
  | cc| 2.3|3.9|  3|
  </code></pre>