This question already has an answer here:
- how to change a Dataframe column from String type to Double type in pyspark 4 answers
I am taking data from hbase and converted it to dataframe. Now, I have a column in data-frame which is string
datatype.But i need to convert its datatype to Int
.
Tried below code but its throwing me an error
df.withColumn("order", 'order.cast(int)')
Error i am facing is below
error:col should be column
I have given proper column name here, Do i need to change the syntax of above mentioned code in pyspark?