我有以下数据帧:
1 2 3 4 5 6 7 8 9 10
dog cat 1 1 0 1 1 1 0 0 1 0
dog 1 1 1 1 1 1 0 0 1 1
fox 1 1 1 1 1 1 0 0 1 1
jumps 1 1 1 1 1 1 0 1 1 1
over 1 1 1 1 1 1 0 0 1 1
the 1 1 1 1 1 1 1 0 1 1
我想首先删除行和列中的所有标签,使df变成:
1 1 0 1 1 1 0 0 1 0
1 1 1 1 1 1 0 0 1 1
1 1 1 1 1 1 0 0 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 1 1 1 0 0 1 1
1 1 1 1 1 1 1 0 1 1
然后将这些值串联成一个长整数,这样它就变成:
110111001011111100111111110011111111011111111100111111111011
有没有人知道用最短的代码片段做这件事的方法。我很感激你的建议。非常感谢。你知道吗
IIUC公司
或者
选项1
apply(str.join)
+str.cat
:选项2
apply
+np.add
,文在寅提出:相关问题 更多 >
编程相关推荐