【发布时间】:2018-12-21 01:32:17
【问题描述】:
我有一个数字列表,1-6,我需要所有可能的排列,并且需要存储在数据框中。但我还需要数据框将列命名为“Month 1”、“Month 2”、“Month 3”等。
所以我想要这样的东西:
Month 1 Month 2 Month 3 Month 4 Month 5 Month 6
1 2 3 4 5 6
1 2 3 4 6 5
1 2 3 5 4 6
1 2 3 5 6 4
etc.
我需要存储所有 720 个可能的排列。
我该怎么做?我尝试过使用itertools.permutation,但遇到了问题。
【问题讨论】:
-
显示您的尝试,然后我们将帮助您修复错误。我们不会为你写的。
标签: python permutation itertools