I wanted to check whether a string is convertible to an integer inside lambda expression.
import re,time
rdd = sc.textFile("file:///home/vdpqa/sample.gz")
new1 = rdd.map(lambda x: re.split('/|\.|\|',x))
.filter(lambda arr: (len(arr) > 9) and isinstance(arr[7],int)).map(lambda x: x[:9])
new = new1.map(lambda x: [x[0],x[1],x[3],
time.strftime('%Y%m%d', time.localtime(int(x[7])/1000000)),x[8]])
I checked this question but it didn't help:
>>> isinstance(1448379000595770,int)
True
>>> isinstance('1448379000595770',int)
False