First pyspark code in jupyter lab executed with error message

Please don’t point to a screenshot for an error message. (Aside from the fact it wasn’t place in here in a way that works. Or the automoderating blocked it.) Put it as text in the post. Preferably the entire error message. If it is very long then post it at a snipper sharing service, like GitHub’s gist and provide a link.

Please read Getting good answers to your questions and follow it as a guide. In fact, the last reference there, 'How do I ask a good question? emphasizes in bold out on such forums that images never suffice.

For one thing, the way the system links related things is through text and if there is no text it won’t get seen by the correct eyes. So it is in your interest to follow guidelines.

With the little you have provided, it is hard to tell if you have even the correct forum. If you ran this directly in Python, would similar things happen?