I have a list like:
[
{'p': 0},
{'p': 1},
{'p': 1},
{'p': 0},
{'p': 0},
{'p': 2}
]
I want to split it into segments based on attribute p, so the result would be:
[[{'p':0}], [{'p':1}, {'p':1}], [{'p':0}, {'p':0}], [{'p':2}]]