2
map
はリストのメソッドではなく、その原因であることがわかりました。しかし、マップ関数を使用して、内部マップと呼ばれる関数にデータを渡す方法があります。'list'オブジェクトには属性 'map'がありません
は、ここに私のコードです:
def func1(lines):
global newlst
for line in lines:
qtype = re.search("qtype=(\S+)",str(line))
......
file = sc.textFile("C:\\TestLogs\\sample.log").cache()
result = file.map(lambda x: x.split("\n")).collect()
print(type(result)) #it is a list
lines = result.map(func1).collect() #I want to pass the contents of result to func1 through map function.
エラー:
lines = result.map(func1).collect()
AttributeError: 'list' object has no attribute 'map'
私はしかしmap
または生成スパークのいずれかの概念を使用してresults
からfunc1
に自分のデータを渡すことができ、他の方法はありますrdd?
'.collect()' –