Replace all numeric values in a pyspark dataframe by a constant value
As per your problem, I think it might be easier to use lit. Try this-

from pyspark.sql.functions import lit
new_df = df.withColumn('column_name', lit(1))


Hope it helps!