Я пытаюсь выбрать некоторые столбцы из RDD, в котором есть данные, считанные из файла CSV. Однако эти операции приводят к тому, что СДР по какой-то причине становится неработоспособным.
Код:
raw = sc.textFile('/FileStore/tables/Tweets.csv')
header = raw.first()
raw = raw.filter(lambda line: line!=header)
raw = raw.map(lambda x: x.split(',')[10:]).map(lambda x: x[:-4]).filter(lambda x: x)
raw.take(10)
Результат:
Нечто вроде
[['@VirginAmerica What @dhepburn said.'],
["@VirginAmerica plus you've added commercials to the experience... tacky."],
["@VirginAmerica I didn't today... Must mean I need to take another trip!"],
['"@VirginAmerica it\'s really aggressive to blast obnoxious ""entertainment"" in your guests\' faces & they have little recourse"'],
["@VirginAmerica and it's a really big bad thing about it"],
['"@VirginAmerica yes',
' nearly every time I fly VX this “ear worm” won’t go away :)"'],
['"@VirginAmerica Really missed a prime opportunity for Men Without Hats parody',
' there."'],
['"@virginamerica Well', ' I didn\'t…but NOW I DO! :-D"'],
['"@VirginAmerica it was amazing',
' and arrived an hour early. You\'re too good to me."'],
['@VirginAmerica did you know that suicide is the second leading cause of death among teens 10-24']]
Структура вышеуказанного СДР выглядит иначе. Что я делаю не так.