Welcome to the Cloudera Community

Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Who agreed with this topic

AssertionError: col should be Column

avatar
New Contributor

Hi,

I'm novice in pyspark.I'm using spark version 2.0.2 & python 2.7.I want to add index column in my data frame.So I used following code

z=np.array(np.arange(data.count()), dtype=np.int32)

data1 = data.withColumn('index', z)

 

But I'm getting error message as

AssertionError: col should be Column

 Can you please help me to solve the error?

Who agreed with this topic