如何在python中生成未配对的数据

如何在python中生成未配对的数据,python,pandas,Python,Pandas,我的数据是这种格式的 ID input_1 input_2 1 'hello' 'greeting' 2 'algorithm' 'computer science' . . . . . . 可以将input_1和input_2视为成对数据,python中是否有方法或库将它们洗牌以使input_1和i

我的数据是这种格式的

ID         input_1         input_2
1          'hello'         'greeting'
2          'algorithm'     'computer science'
.             .               .
.             .               .

可以将input_1和input_2视为成对数据,python中是否有方法或库将它们洗牌以使input_1和input_2不成对

您可以使用随机模块-很有趣,它有一个随机播放功能

随机洗牌(输入_1)

(注意,shuffle操作到位,恶心)

我认为您可以使用:


将数据作为数据帧读入,然后使用索引df.ix[行编号、列编号]对其进行处理,并获取您想要获取和处理的内容。

您能解释更多吗?您需要在一列中只洗牌值吗?谢谢,我将尝试。如何确保两列完全不成对?列中是否重复?然后使用这种方式
mask=(df1==df2)。all(axis=1)
然后
print df1[mask]
-获取两个数据帧中相同的所有值。
df.input_1 = np.random.permutation(df.input_1)
print (df)
   ID      input_1             input_2
0   1  'algorithm'          'greeting'
1   2      'hello'  'computer science'