I have a DataFrame and I'd like to make only specific parts of strings to be made uppercase with an underscore afterwords.
| TYPE | NAME |
|-----------------------------|
| Contract Employee | John |
| Full Time Employee | Carol |
| Temporary Employee | Kyle |
I'd like the words "Contract" and "Temporary" made into uppercase like this with an underscore after and before the word:
| TYPE | NAME |
|-------------------------------|
| _CONTRACT_ Employee | John |
| Full Time Employee | Carol |
| _TEMPORARY_ Employee | Kyle |
I tried using str.upper() but that made the entire cell uppercase and I'm looking only for those certain words.
EDIT: I should mention sometimes the words are not capitalized if that matters. Often it will display as temporary employee instead of Temporary Employee.