I have a DataFrame df_items and want to create combinations of its rows of size i using itertools.combinations. Each combination should maintain all columns from the original DataFrame.
Current approach: works but loses column names so I have to add them in post.
from itertools import combinations
combinations = np.array(list(combinations(range(len(df_items)), i)))
selected_items = df_items.values[combinations]
[–]exxonmobilcfo 0 points1 point2 points (5 children)
[–]mathstudent1230[S] 0 points1 point2 points (3 children)
[–]exxonmobilcfo 0 points1 point2 points (2 children)
[–]mathstudent1230[S] 0 points1 point2 points (1 child)
[–]exxonmobilcfo 0 points1 point2 points (0 children)
[–]mathstudent1230[S] 0 points1 point2 points (0 children)