I am not very good at regex, trying to improve here. I am trying to split a string column which has values like:
1000+10%
300-7%
I am using
pattern = r'[+|-]'
df[postsplitcol] = df[col].str.split(pattern)
However, what happens is the + or the - sign also gets removed. How can i retain the + or the - in the right string post split ? I have tried looking at some similar questions on the forum, but could not find an efficient way that addresses the either pattern of the split which am trying to split on here.