I am working on a Pyspark using the flatMap function and I am using the split within the function. But I am getting an error which says: AttributeError: 'NoneType' object has no attribute 'split''
I am watching a video and replicating the same thing I am seeing in the video. It works in the video but I keep getting this error. Below is my code:
datasetfor2019.map(lambda col: col[Conditions])\
.filter(lambda x: x!='')\
.flatMap(lambda x: x.split(','))\
.map(lambda x: (x, 1))\
.reduceByKey(add)\
.sortBy(lambda x: x[1], ascending=False)\
.take(5)
I will like to know what I am doing wrong or if I need to import anything into my Pyspark environment, what could that be?
Thanking you in advance.
null? The error seems to point in that direction