I'm missing a desired character from this string:
df=pd.DataFrame({Score:[1.20\n1\n99%\n6.75\nX\n-\n14\n2\n1%\n+72]})
Desired result:
1.20\n6.75\n14.00
Here is the regex I used:
.str.findall(r'(?m)^\d+\.\d+$').str.join("\n")
This regex is not capturing \n14; I want the result to be \n14.00. In other words the regex must handle the missing float point and inserting the 00 as appropriate. Meaning if this happens across any of the desired values in the list/string. So I'm stuck on finding a solution.
See the current regex result in code below:
import pandas as pd
import re
df=pd.DataFrame({'Score: ['1.20\n1\n99%\n6.75\nX\n-\n14\n2\n1%\n+72']})
df = df['Score'].str.findall(r'(?m)^\d+\.\d+$').str.join("\n")
df
0 1.20\n6.75
Name: Score, dtype: object