从长字符串中分别提取冒号的字符串

目标:提取冒号分隔的字符串。

输入数据如下:

0   Billing and Compliance Report - Heidt, Amanda ...
1                                   Female - 02/08/79
2                         Documentation complete: all
3   Amanda L Heidt                                ...
4                                 Patient Information
5   Patient Name: Amanda L Heidt          MRN: 834...

It's a huge amount of data but I only shared some of the lines. I have opened the CSV file in pandas v 3.7 however, using findall function

elements = re.findall("^[^:]+:\\s*","",file)
for element in elements:
    print(element)

我遇到错误

'DataFrame' objects are mutable, thus they cannot be hashed.

我是Python的新手。我一直在尝试寻找答案,但可能对寻找正确答案的了解还不够。有人可以建议我仅提取冒号字符串的正确代码吗?

评论