我有这样一个数据框:
'a' 'b' 'c' 'd' 'e' 'f'
'hello.text' 1 2 'hello2.text' 2 10
'hello3.text' 5 8 'hello4.text' 8 15
现在我需要将“a”、“b”、“c”列随机排列在一起。
像这样的事情:
'a' 'b' 'c' 'd' 'e' 'f'
'hello3.text' 5 8 'hello2.text' 2 10
'hello.text' 1 2 'hello4.text' 8 15
我该怎么做?你知道吗
Tags:
将
'a', 'b', 'c'
列随机化在一起,意味着只对这些特定列的行洗牌?如果是,则以下内容满足您的需要:您可以使用
random_state
参数来控制随机化。你知道吗使用} 分别处理每一列,因为不同类型的数据:
np.random.permutation
和^{相关问题 更多 >
编程相关推荐