Recommand · January 13, 2022 0

How to replace column value in dataframes spark?

so I created students datafram from this list

example_scores=[('Ann', 92),('Bob',55) ]

scores_df = spark.createDataFrame(example_scores,schema=['Name','Score'])

scores_df.show()

I want to replace students score with a number.
for example if their score is between 51,60 when these dataframe will i want it to show
–Bob, 6– and etc.
I want to use if statement but I dont know how to filter so much with in dataframe.
I tried regexp_replace, translate, but its not working.