Can only zip RDDs with same number of elements in each partition despite repartition
<p>I load a dataset</p>

<pre><code>val data = sc.textFile("/home/kybe/Documents/datasets/img.csv",defp)
</code></pre>

<p>I want to put an index on this data thus</p>

<pre><code>val nb = data.count.toInt
val tozip = sc.parallelize(1 to nb).repartition(data.getNumPartitions)

val res = tozip.zip(data)
</code></pre>

<p>Unfortunately i have the following error</p>

<pre><code>Can only zip RDDs with same number of elements in each partition
</code></pre>

<p>How can i modify the number of element by partition if it is possible ?</p>