Is there a way to split a dataframe on the 4th delimiter from the right?
For example, if I wanted to split this:
A
Hello, world, what can, I do for, you
Hi, Hi, Hi, Hi, Hi, Hi
Yes, Yes, Heloo, Hi, Hi, Hi, Hi
Into this:
A B C
Hello, world, what can, I do for, you Hello world, what can, I do for, you
Hi, Hi, Hi, Hi, Hi, Hi Hi, Hi Hi, Hi, Hi, Hi
Yes, Yes, Heloo, Hi, Hi, Hi, Hi Yes, Yes, Heloo Hi, Hi, Hi, Hi
I know that I can use the following to split on the last delimiter.
NEWDF = DF.A.str.rsplit(', ', 1, expand=True).rename(lambda x: f'col{x + 1}', axis=1)
I am just wondering if there is a way to split on the x from last...