I'm beginner on Python and Spark. After creating a DataFrame
from CSV
file, I would like to know how I can trim a column. I've try:
df = df.withColumn("Product", df.Product.strip())
df
is my data frame, Product
is a column in my table
But I see always the error:
Column object is not callable
Do you have any suggestions?
from pyspark.sql.functions import trim
df = df.withColumn("Product", trim(col("Product")))