I want to extract word from this data frame
statutInit
Majoration : 0,06‰ Capital
The output I want
statutInit statute taux
Majoration : 0,06‰ Capital Majoration Capital 0,06‰
Thank!!
You can try this:
df['statute'] = [re.split(r'[^a-zA-Z]+', val.strip()) for val in df['statutInit']]
df['statute'] = [' '.join(val) for val in df['statute']]
df['taux'] = [re.split(r'[a-zA-Z:\s]+', val.strip()) for val in df['statutInit']]
df['taux'] = [''.join(val) for val in df['taux']]
print(df)
Output:
statutInit statute taux
0 Majoration : 0,06‰ Capital Majoration Capital 0,06‰
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.