Isso porque num = {1,2,3,4,5,6,7}
não é uma "matriz de números" - é um conjunto .
>>> num = {1,2,3,4,5,6,7}
>>> type(num)
<type 'set'>
>>> numpy.mean(num)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 2885, in mean
out=out, keepdims=keepdims)
File "/usr/lib/python2.7/dist-packages/numpy/core/_methods.py", line 72, in _mean
ret = ret / rcount
TypeError: unsupported operand type(s) for /: 'set' and 'int'
enquanto
>>> num = (1,2,3,4,5,6,7)
>>> type(num)
<type 'tuple'>
>>> numpy.mean(num)
4.0