My dataset is as the example below:
Index ID
0 1.4A
1 1.4D
2 5B
3 D6C
4 ZG67A
5 ZG67C
I want to add a "-" before the last position of the values in my column. The values don't have a consitent lenght, therefore I cannot choose a position to place the - between, as in this helpful post
One good solution in the related post is to use pd-Series.str and to chose a position
df['ID'.str[2:] + "-" + df["c"].str[4:]
I somehow need to address the position before the last letter in every row in my column['ID']. Later I want to apply split, but as far as I understood split, it needs a delimiter to split.
Best Outcome:
Index ID
0 1.4-A
1 1.4-D
2 5-B
3 D6-C
4 ZG67-A
5 ZG67-C
Thanks