I am trying to determine if a column is a vector type, but am running into issues.
After I run a model and create a dataframe called predictions, there is a field called probability.
When I run this code to see the datatype if shows a vector.
predictions.schema['probability'].dataType
Out[128]: VectorUDT
Then when I run this I get a false returned
predictions.schema["probability"].dataType == 'VectorUDT'
Out[129]: False
So I tried this
dict(predictions.dtypes)['probability'] == 'vector'
Out[130]: True
However, when I try to use that in my dataframe I get an error stating TypeError: unhashable type: 'Column'
.withColumn('test', when(dict(predictions.dtypes)['probability'] == 'vector',1)
.otherwise(0)) \