I have to clean a dataset but the data are messed up. For example, I want to replace the last word in a string only if it is "KG." into "KILOGRAM". I do not know how to write the regex for that.
I also wonder how to extract certain conditional data to a new column. For example, I want to extract the whole string that is a FRUIT. I want. my data to look like the following:
DATA DATA NEW DATA_FRUIT ID
255 KG. 255 KILOGRAM
FRUIT ID 978 FRUIT ID 978
119 KG 119 KG
Should I use find and replace or REGEX?