【问题标题】:Extract numbers and the neighboring words from text data in python [closed]从python中的文本数据中提取数字和相邻单词[关闭]
【发布时间】:2019-05-08 17:33:45
【问题描述】:

我在一列数据框中有文本字符串数据

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

【问题讨论】:

    标签: python regex data-extraction


    【解决方案1】:
    ([a-zA-Z]+) *?\$?([0-9]+) ?([a-zA-Z]*)
    

    Try it out online

    【讨论】:

      猜你喜欢
      • 2014-11-06
      • 1970-01-01
      • 2016-01-20
      • 2021-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多