回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我试图找出一个数字列表的最大值。在</p>
<p>使用Python 2.7 IDLE,我尝试了以下操作:</p>
<pre><code>import numpy
vectors = [[1, 2, 3], [4,5,6]]
numpyFiles = numpy.array(vectors)
maxRawFreq = numpyFiles.max()
</code></pre>
<p>它起作用了,<code>maxRawFreq = 6</code></p>
<p>我尝试使用一个非常相似的代码,使用一个更大的列表,并使用Pydev(Eclipse),但是我得到了以下错误:</p>
<p><code>cannot perform reduce with flexible type</code></p>
<p>这是什么意思?(关于此错误的其他SO问题给出了太具体的解决方案…)。在</p>
<p>我的代码:</p>
^{pr2}$
<p>我的<code>inputFile</code>包含数字,如下所示:</p>
<pre><code>-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-1, 0, 0, 3, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
+1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
</code></pre>