1.我拥有的第一个 Dataframe 如下所示:
| 字符串1|
| - ------|
| Table 671usa50452.tab has been created as of the process date (12-19-22). |
| Table 643usa50552.tab has been created as of the process date (12-19-22). |
| Table 681usa50532.tab has been created as of the process date (12-19-22). |
| Table 621usa56452.tab has been created as of the process date (12-19-22). |
| Table 547usa67452.tab has been created as of the process date (12-19-22). |
我想提取所有包含'usa'之间的帐户和日期指定的每一行有这样的东西:
| 字符串1|账户|日期|
| - ------| - ------| - ------|
| Table 671usa50452.tab has been created as of the process date (12-19-22). | 671usa50452 | 12-19-22 |
| Table 643usa50552.tab has been created as of the process date (12-19-22). | 643usa50552 | 12-19-22 |
| Table 681usa50532.tab has been created as of the process date (12-19-22). | 681usa50532 | 12-19-22 |
| Table 621usa56452.tab has been created as of the process date (12-19-22). | 621usa56452 | 12-19-22 |
| Table 547usa67452.tab has been created as of the process date (12-19-22). | 547usa67452 | 12-19-22 |
我一直在尝试使用以下内容,但信息无法进入新 Dataframe 的列中:
第一个月
1.第二个 Dataframe 类似:
| 字符串2|
| - ------|
| 3203美国34088:资产USA1/asd011245|
| 3203美国34088:资产USA2/ghf023345|
| 3203美国34088:资产美国3/hgf012735|
| 3203美国34088:资产USA4/湿012455|
| 3203美国34088:资产美国5/nbj012245|
我希望得到以下信息:
| 字符串2|账户2|
| - ------| - ------|
| 3200美国34088:资产USA1/asd011245|小行星3200|
| 3201美国34088:资产USA2/ghf023345|小行星3201|
| 3202美国34088:资产美国3/hgf012735|小行星3202|
| 3203美国34088:资产USA4/湿012455|小行星3203|
| 3204美国34088:资产美国5/nbj012245|小行星3204|
3条答案
按热度按时间bwntbbo31#
对于第一个 Dataframe ,我们可以使用
str.extract
如下:对于第二个 Dataframe :
roqulrg32#
我认为这是可行的:
lfapxunr3#
第一个使用案例的答案:
输出:
对于第二种: