Hello,
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’))
df2.show()
NameError Traceback (most recent call last)
in
----> 1 df2 = df.withColumn(“marks”, lit(‘test’))
2 df2.show()
NameError: name ‘lit’ is not defined
Please help.