I am accessing a hive table through spark from jupyter.
I have created a DF and its showing the data of table in DF.
Now I want to add a column to the df.
I’m trying the following code but its throwing error.
df2 = df.withColumn(“Marks”, lit(‘test’))
NameError Traceback (most recent call last)
----> 1 df2 = df.withColumn(“marks”, lit(‘test’))
NameError: name ‘lit’ is not defined