#Transformation
The zipWithIndex() transformation in PySpark is used to assign a unique index to each element in an RDD. The output is a new RDD where each element is a tuple consisting of the original element and its corresponding index.
Syntax: -
rdd.zipWithIndex()
zipWithIndex() is specifically an RDD transformation in PySpark, and it is not directly available for DataFrames.