【发布时间】:2021-04-24 11:29:58
【问题描述】:
我有几个月和几年的数据框,我想将其转换为天
Name details
prem 6 months probation included
shaves 3 years 6 months suspended
geroge 48 hours work time
julvie 4 years 20 days terms included
tiz 80 days work
lamp 44 days work
这里我想更改3 years as 1095 days, 6 months as 186 days,也可以包含闰年,并且我想删除所有其他单词,如probation included, suspended,我想在新列中获得所有结果。
预期结果:
Name details Time
prem 6 months probation included 186 days
shaves 3 years 6 months suspended 1181 days
geroge 48 hours work time 48 hours
julvie 4 years 20 days terms included 1480 days
tiz 80 days work 80 days
lamp 44 days work 44 days
【问题讨论】:
-
你写过代码吗?
标签: python regex pandas data-cleaning