I’m very new to python. two days. trying to get a plot working with matplotlib. I’m getting this error:
cannot perform reduce with flexible type
the line with the error is:
ax.scatter(x,y,z,marker='o')
Variables:
ax is defined as: ax = Axes3D(fig)
fig is defined as: fig = plt.figure()
x, y, z are lists
Any python experts tell me why? I got the plot to work but the values are integers. Decimal values are preferred.
I read that lists in python are not very good with numbers… can someone clarify? I got it to work with lists and ndarrays but all the values have to be integers.
Thanks!
Thanks for the responses.
I got it working with floats but maybe you all can tell me why. I just created an account here and can’t edit my guest question…
I’m getting my data from a sqlite database. I can round the values in the sql or cast to floats and it works. I’m guessing that the data was a numerical object even though it was numerical. Is this correct?
Here’s an excerpt of the code that doesn’t work. I got it to work by casting the values as floats.
unutbu requested the output of print(repr(x)):
and finally here’s the error that it outputs on the line ax.scatter(x,y,z,marker=’o’) :
Like i said i think it was just the wrong type, but if you all can tell me what type causes the error i could learn something.
Thanks.