在python中从文本数据中提取数字和相邻单词
我在数据框的一列中有文本字符串数据在python中从文本数据中提取数字和相邻单词,python,regex,data-extraction,Python,Regex,Data Extraction,我在数据框的一列中有文本字符串数据 Text Column The doctor has advised the patient to pay $200 for the treatment Patient submitted the $200 operation fee but not the admit fee $100 从上面开始,如何提取数字及其前后的单词,并将它们存储在单独的变量中 Expected Results Var1 Var2 pay
Text Column
The doctor has advised the patient to pay $200 for the treatment
Patient submitted the $200 operation fee but not the admit fee $100
从上面开始,如何提取数字及其前后的单词,并将它们存储在单独的变量中
Expected Results
Var1 Var2
pay $200 for
the $200 operation fee $100
([a-zA-Z]+) *?\$?([0-9]+) ?([a-zA-Z]*)