I need to remove the duplicate numbers in a cell and duplicate percentage sign in cell
I have two inputs:
Input1-
- 51 %
- 4% %
- (0.9 %)
- 53 %
- 44 %
- 29 %
Name: Paid Loss Ratio , dtype: object
Req'd output1 :
- 51
- 4
- -0.9
- 53
- 44
- 29
Name: Paid Loss Ratio , dtype: object
The following script works for this case:
f1['Paid Loss Ratio '].str.split('%').apply(set).str.join('').str.rstrip()
Trying to remove the duplicated "% sign in one cell"
input2 -
-
88 % -
102 % - 84 84 %
-
( 0.8 % -
93 %
Name: Constant Loss Ratio , dtype: object
Req'd Output2 :
- 88 %
- 102 %
- 84 %
- -0.8%
- 93 %
Trying the following but it doesn't work properly:
re.sub(r'([0-9])(.*)\1+', r'\1', str(ab))
Trying to remove the duplicated "84" number in one cell
Also is there a way to merge these two scripts/pattern?