Q: Python ValueError: setting an array element with a sequence I have a script that I wrote on my machine using Python 3.2, because of the size of the data files involved I need to run it on another machine that runs version 2.5 . When I run the following bit of code that converts a python list to a numpy array I get the following error 
Traceback (most recent call last):
File "count_code2.py", line 119, in <module>
cell_centers()
File "count_code2.py", line 58, in cell_centers
read_file(F)
File "count_code2.py", line 44, in read_file
Xa = numpy.array(X, dtype=float)       #Converts lists to NumPy arrays
ValueError: setting an array element with a sequence.

the bit of code the error is referring to is
Xa = numpy.array(X, dtype=float)       #Converts lists to NumPy arrays
Ya = numpy.array(Y, dtype=float)
Za = numpy.array(Z, dtype=float)

Where X, Y and Z are the following Python lists(test lists)
X= ['0', '0', '0', '1.5', '0', '0', '0', '0', '0', '0']
Y= ['0', '0', '0', '1', '0', '0', '0', '0', '0', '0']
Z= ['0', '0', '0', '1', '0', '0', '0', '0', '0', '0']

I have tried recasting the dtype as object as I have read in similar posts that this can fix the problem. It does stop the error from being thrown, but another function that sums the data in the arrays returns zeros on the python 2.x machine and gives this error on the 3.2 machine
File "C:\Documents and Settings\My Documents\Count_Code.py", line 103, in counter
((ymin <= Ya) & (Ya <= ymax))&
TypeError: unorderable types: float() <= str()

I am assuming that dtype object turns the list to an array of strings and that is why I get this error. I would like to ask if someone can explain why the differences in versions is causing the errors, and what I can do to work around it. Thanks in advance
