Problem with importing nums csv

I'm having difficulty importing data from a file .csv. I am just trying to import data and print the maximum value. Here is my code:

>>> x, y = numpy.loadtxt('data.csv', delimiter=',', usecols=(4,5), unpack=True)
>>> print 'max =', max(x)

When you enter the above code, the following error message appears:

TypeError: 'numpy.float64' object is not iterable

I tried changing the data type with an argument dtype=int, but it threw the same error. Does anyone know what could be the problem? Thanks in advance for your help!

+3
source share
1 answer

loadtxt(), , : , x y , . max() Python , .

max() Python numpy.max() NumPy. ,

print x.max()

print numpy.max(x)

.

+4

All Articles