I have a table that looks like:
| id | string |
|---|---|
| 3.ab.3. | axz |
| 3.ab.3.a. | b |
| 3.ab.3.b. | c |
| 3.ab.4. | dog |
| 3.ab.4.a. | e |
| 3.ab.4.b. | f |
| 3.ab.4.b.1 | g |
| 3.ab.4.b.2 | h |
What I expect is the subcategory should have the string from its main category so 3.ab.3.a should have everything from 3.ab.3. and then the get rid of 3.ab.3.
| id | string |
|---|---|
| 3.ab.3.a. | axzb |
| 3.ab.3.b. | axzc |
| 3.ab.4.a. | doge |
| 3.ab.4.b.1 | dogfg |
| 3.ab.4.b.2 | dogfh |
I tried using .join and .startswith but couldn't get through
Try this:
Output: