So I have a dataframe with one column like this:
+----------+
|some_colum|
+----------+
| 10|
| 00|
| 00|
| 10|
| 10|
| 00|
| 10|
| 00|
| 00|
| 10|
+----------+
where the column some_colum are binary strings.
I want to convert this column to decimal.
I've tried doing
data = data.withColumn("some_colum", int(col("some_colum"), 2))
But this doesn't seem to work. as I get the error:
int() can't convert non-string with explicit base
I think cast() might be able to do the job but I'm unable to figure it out. Any ideas?