从Python(Google Colabs)的列中提取指定的文本

发布于 2025-02-08 09:32:00 字数 1962 浏览 1 评论 0原文

我希望从Python(Google Colabs)的下表中提取指定的数据。

<style type="text/css">
    table.tableizer-table {
        font-size: 12px;
        border: 1px solid #CCC; 
        font-family: Arial, Helvetica, sans-serif;
    } 
    .tableizer-table td {
        padding: 4px;
        margin: 3px;
        border: 1px solid #CCC;
    }
    .tableizer-table th {
        background-color: #104E8B; 
        color: #FFF;
        font-weight: bold;
    }
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>Source</th><th>Description</th><th>Services</th></tr></thead><tbody>
 <tr><td>Receivable Invoice</td><td>Peter Jackson - 2/2/2022 - Access Community, Social And Rec Activities - Standard - Weekday Daytime - TTP 9:00AM 12:00PM 04_104_0125_6_1_T</td><td>Access Community, Social And Rec Activities - Standard - Weekday Daytime - TTP 9:00AM 12:00PM 04_104_0125_6_1_T</td></tr>
 <tr><td>Receivable Invoice</td><td>Helen Johnson - 30/06/2021- - Transport 04_590_0125_6_1</td><td>Transport 04_590_0125_6_1</td></tr>
 <tr><td>Receivable Invoice</td><td>Charlotte Jane - Reversal of difference charged Domestic shifts from 22/9/2021 - 31/12/2021</td><td>&nbsp;</td></tr>
 <tr><td>Receivable Invoice</td><td>Mary Jane - Support Coordination - 10/3/2022 - Psychosocial Recovery Coaching - Weekday Daytime 07_101_0106_6_3</td><td>Psychosocial Recovery Coaching - Weekday Daytime 07_101_0106_6_3</td></tr>
</tbody></table>

上面显示了我在Python中想要的表。列“服务”是从“描述”列中提取的提取文本。

如您所见,很少有数据不应该拾取,例如第3行。

在过去的几天里,我一直在此代码中陷入困境,请感谢是否有人能提供潜在客户。

预期结果是“服务”列。

I'm looking to extract specified data from the below table in Python (Google Colabs).

<style type="text/css">
    table.tableizer-table {
        font-size: 12px;
        border: 1px solid #CCC; 
        font-family: Arial, Helvetica, sans-serif;
    } 
    .tableizer-table td {
        padding: 4px;
        margin: 3px;
        border: 1px solid #CCC;
    }
    .tableizer-table th {
        background-color: #104E8B; 
        color: #FFF;
        font-weight: bold;
    }
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>Source</th><th>Description</th><th>Services</th></tr></thead><tbody>
 <tr><td>Receivable Invoice</td><td>Peter Jackson - 2/2/2022 - Access Community, Social And Rec Activities - Standard - Weekday Daytime - TTP 9:00AM 12:00PM 04_104_0125_6_1_T</td><td>Access Community, Social And Rec Activities - Standard - Weekday Daytime - TTP 9:00AM 12:00PM 04_104_0125_6_1_T</td></tr>
 <tr><td>Receivable Invoice</td><td>Helen Johnson - 30/06/2021- - Transport 04_590_0125_6_1</td><td>Transport 04_590_0125_6_1</td></tr>
 <tr><td>Receivable Invoice</td><td>Charlotte Jane - Reversal of difference charged Domestic shifts from 22/9/2021 - 31/12/2021</td><td> </td></tr>
 <tr><td>Receivable Invoice</td><td>Mary Jane - Support Coordination - 10/3/2022 - Psychosocial Recovery Coaching - Weekday Daytime 07_101_0106_6_3</td><td>Psychosocial Recovery Coaching - Weekday Daytime 07_101_0106_6_3</td></tr>
</tbody></table>

Above shows the Table that I want in Python. The Column "Services" is the extract specified text from Column "Description".

As you can see, there are few data which shouldn't pick up, for instance Row 3.

I have been stuck in this code for the past few days, appreciate if anyone could provide a lead.

Expected outcome is Column "Services".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文