I have the following data:
| ID | content | date |
|---|---|---|
| 1 | 2429(sach:MySpezialItem :16.59) | 2022-04-12 |
| 2 | 2429(sach:item 13 :18.59)(sach:this and that costs:16.59) | 2022-06-12 |
And I want to achieve the following:
| ID | number | price | date |
|---|---|---|---|
| 1 | 2429 | 2022-04-12 | |
| 1 | 16.59 | 2022-04-12 | |
| 2 | 2429 | 2022-06-12 | |
| 2 | 18.59 | 2022-06-12 | |
| 2 | 16.59 | 2022-06-12 |
What I tried
df['sach'] = df['content'].str.split(r'\(sach:.*\)').explode('content')
df['content'] = df['content'].str.replace(r'\(sach:.*\)','', regex=True)