samedi 28 février 2015

Load CSV file with Spark


Vote count:

0




I'm new to Spark and I'm trying to read CSV data from a file with Spark. Here's what I am doing :



sc.textFile('file.csv')
.map(lambda line: (line.split(',')[0], line.split(',')[1]))
.collect()


I would expect this call to give me a list of the two first columns of my file but I'm getting this error :



File "<ipython-input-60-73ea98550983>", line 1, in <lambda>
IndexError: list index out of range


although my CSV file as more than one column.



asked 28 secs ago







Load CSV file with Spark

Aucun commentaire:

Enregistrer un commentaire