擅长:python、mysql、java
<p>在@MaxU解决方案的基础上,我喜欢继续将“gene_name”放入索引中,不用担心所有的索引切片:</p>
<pre><code>df = pd.read_csv(tfile, delim_whitespace=True, index_col=0)
df[df.gt(0).sum(1).ge(3)]
</code></pre>
<h3>编辑问题更新:</h3>
^{pr2}$
<p>输出:</p>
<pre><code> A B C D E F
Gene_name
Gene4 12 0 6 8 7 4
Gene7 13 45 64 234 0 6
Gene8 11 6 0 7 7 9
Gene9 6 0 12 34 0 11
Gene10 23 4 6 7 89 0
</code></pre>