How to make delimited item in split_at (more_itertools) dynamic

112 Views Asked by At

I am using split_at from more_itertools. The reason is that I have a list of 70k records in which Record i [Record 1, Record 2, ...Record n] occurs. I need to split the list at these Record i occurences. How can i implement this in the following code?

Note tha n is unkown

Result = list(split_at(lst, lambda x: x == 'Record i'))

This is my input (subset)

[1] "Record 1"
[1] 1010286
[1] 7
[1] F
[1] "Record 2"
[1] 1000152
[1] 5
[1] M

This is my desired output (in a dataframe)

"Record 1", 1010286, 7, F 
"Record 2", 1000152, 5, M
0

There are 0 best solutions below