I want to add a new column to the dataframe with values consist of either 0 or 1. I used 'randint' function from,
from random import randint
df1 = df.withColumn('isVal',randint(0,1))
But I get the following error,
/spark/python/pyspark/sql/dataframe.py", line 1313, in withColumn assert isinstance(col, Column), "col should be Column" AssertionError: col should be Column
how to use a custom function or randint function for generate random value for the column?