I am applying a method and it is giving error because the cast is not well done
How could I 1) cast all fields in a more efective way, 2) use withColumn just one time and then 3) run the method with numbers (not string):
q5 = q4.withColumn("DISTANCE", q4["LOCLAT"].cast(IntegerType()))
q6 = q4.withColumn("DISTANCE", q4["LOCLONG"].cast(IntegerType()))
q7 = q4.withColumn("DISTANCE", q4["LOCLAT2"].cast(IntegerType()))
q8 = q4.withColumn("DISTANCE", q4["LOCLONG2"].cast(IntegerType()))
q9 = (q4.withColumn('distance', haversine('LOCLONG', 'LOCLAT', 'LOCLONG2', 'LOCLAT2')))
Thanks!!