I'd like to add a column in my dataframe in PySpark with the address parsed through the libpostal library.
import pyspark.sql.functions as sf
from postal.parser import parse_address
df = spark.read.parquet(path_hdfs)
df = df.select("id", "name" ,"street", "cty")\
.withColumn("address", parse_address(sf.concat(col("street"),sf.lit(" ") ,col("cty"))))\
.dropDuplicates()
but I get the error:
TypeError: cannot convert 'Column' object to bytes
how can I change the argument of parse_address in order to be accepted by that function?