Search code examples
pythonmachine-learninglambdadata-sciencerecommendation-engine

parsed_json = kstream.map(lambda (k,v): json.loads()), invalid syntax error problem


Getting below error:

SyntaxError: invalid syntax error on this line of the code -> parsed_json = kstream.map(lambda (k,v): json.loads()) arrow indicating (>k,a), link to the code is https://github.com/patilankita79/Location-based-Restaurants-Recommendation-System/blob/master/BigDataProject/Consumer.py


Solution

  • The error is in lambda function signature. The correct is:

    kstream.map(lambda k, v: json.loads(v))