I have the DF as below
col1
GRE MET HOCK 38
ASS COM CORD EMERG INIT
I would like to create a column with first string of each word from col1 but keeping integer, such as below
col1 col2
GRE MET HOCK 38 GMH38
ASS COM CORD EMERG INIT ACCEI
I found something that might work, but not giving the expected output
import re
input = "GRE MET HOCK 38"
output = "".join(item[0].upper() for item in re.findall("\w+", input))