79273300

Date: 2024-12-11 22:09:50
Score: 1
Natty:
Report link

You need to add an "r" to make a raw string so the backslashes will be interpreted correctly

food['GPA'] = food['GPA'].astype(str).str.extract(r'(\d*\.\d+|\d+)', expand=False)
food['GPA'] = pd.to_numeric(food['GPA'], errors='coerce')
print(food['GPA'].unique())
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: joel