I would like to use bigtree to transform my polars/pandas dataframe to a tree in the following way.
My data looks something like this:
id, parrent, val1, val2
1, 0, ..., ...
1, 0, ..., ...
1, 0, ..., ...
2, 1, ..., ...
2, 1, ..., ...
3, 1, ..., ...
3, 1, ..., ...
3, 1, ..., ...
4, 2, ..., ...
4, 2, ..., ...
4, 2, ..., ...
4, 2, ..., ...
I would like to transform them into a tree that looks like this:
1[[val1,val2], [val1,val2], [val1,val2]]
|--2[[val1,val2], [val1,val2]]
| |--4[[val1,val2], [val1,val2], [val1,val2], [val1,val2]]
|
|--3[[val1,val2], [val1,val2], [val1,val2]]
Is there a simple way to do this?