Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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 |

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. | dogf |

What I have tried:

I tried using .join and .startswith but couldn't get through
Posted
Updated 27-Feb-23 21:52pm
Comments
Richard Deeming 28-Feb-23 3:53am    
Well, try harder then.

Nobody here is going to do your work for you, even if you had provided a clear explanation of the problem (which you haven't).

If you want help fixing your code, you need to explain clearly and precisely what you are trying to do, show the relevant parts of your code, and explain where you are stuck.

1 solution

See pandas documentation — pandas 1.5.3 documentation[^]. But if you want specific help then please use the Improve question link above, and add complete details of the code, and any results, to your question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900