My df
has 2 columns:
Name Attr
a(bc)
b(aca)
(cba)
I would like the column Attr
to have the values within parentheses of column Name
Name Attr
a(bc) bc
b(aca) aca
(cba) cba
I tried:
df['Attr'] = re.findall('(.*?)',df['Name'].astype('str'))
TypeError: expected string or buffer
Really appreciate any help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…