I removed all the null values and numbers from my data. I only have list of lists containing text strings and '|'. I want to loop over my RDD object and replace the '|' with '' or even remove it.
I tried using the map function and then I linked it to an external function
def fun(item):
newlist=list()
for i in item:
if '|' == i or '|' in i:
j=''
newlist.append(j)
else:
newlist.append(i)
return newlist
final=orginial.map(x : fun(x))
input: [['Hello','|'],..]
expected output: [['Hello',''],..]
actual output: [['Hello','|'],..]