'Liste' - Objekt hat kein Attribut 'anzeigen'

Ich weiß, es ist Ursache, dass map ist eine Funktion und keine Methode der Liste. Aber gibt es eine Möglichkeit, ich kann die map-Funktion zum übergeben von Daten an die Funktion aufgerufen, in anzeigen.

Hier ist mein code:

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.

Fehler:

    lines = result.map(func1).collect()
AttributeError: 'list' object has no attribute 'map'

Gibt es eine andere Möglichkeit kann ich Euch meine Daten von results zu func1 aber mit map oder jeden Begriff in Funken, der erzeugt ein rdd?

  • Nicht .collect()
InformationsquelleAutor kaks | 2016-10-27
Schreibe einen Kommentar