I would like to split one DataFrame into N Dataframes based on columns X and Z where they are the same (as eachother by column value).
For example, this input:
df =
NAME X Y Z Other
0 a 1 1 1 1
1 b 1 1 2 2
2 c 1 2 1 3
3 d 1 2 2 4
4 e 1 1 1 5
5 f 2 1 2 6
6 g 2 2 1 7
7 h 2 2 2 8
8 i 2 1 1 9
9 j 2 1 2 0
Would have this output:
df_group_0 =
NAME X Y Z Other
0 a 1 1 1 1
2 c 1 2 1 3
4 e 1 1 1 5
df_group_1 =
NAME X Y Z Other
1 b 1 1 2 2
3 d 1 2 2 4
df_group_2 =
NAME X Y Z Other
6 g 2 2 1 7
8 i 2 1 1 9
df_group_3 =
NAME X Y Z Other
7 h 2 2 2 8
9 j 2 1 2 0
Is this possible?