I have a data frame column that contains text like this
col
0 abc-text1
1 def_text2-
What I would like to do with pyspark is that if my col startswith 'abc-' then replace it with just 'abc' and if it starts with 'def_' then replace it with def.
I would like to create a function for the same. I am fairley new to python and pyspark thus need help on this.