Replace string in PySpark
问题 I am having a dataframe, with numbers in European format, which I imported as a String. Comma as decimal and vice versa - from pyspark.sql.functions import regexp_replace,col from pyspark.sql.types import FloatType df = spark.createDataFrame([('-1.269,75',)], ['revenue']) df.show() +---------+ | revenue| +---------+ |-1.269,75| +---------+ df.printSchema() root |-- revenue: string (nullable = true) Output desired: df.show() +---------+ | revenue| +---------+ |-1269.75| +---------+ df