Ticks ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

536
September 15, 2017, at 00:06 AM

I want to set an interval on my x axis (histogram) but when I run my code, this ValueError is raised: "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". It refers to this lign of code: P.xticks(min(x), max(x), 0.01)

Here is the code:

import numpy as np
import pylab as P
P.figure()
x = X
n, bins, patches = P.hist(x, 10, normed=1, histtype='bar',
                          label=['SPX Index', 'MXEF Index', 'NKY Index', 'SX5E Index', 'UKX Index', 'SMI Index', 'OMX Index'])
P.xticks(min(x), max(x), 0.01)
P.legend(loc='upper right', fontsize=8)
P.show()

FYI, X refers to X = df.ix[:,:].values

type(X) = numpy.ndarray (n x k matrix)

Thanks for your help!

Rent Charter Buses Company
READ ALSO
Ticks ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Ticks ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I want to set an interval on my x axis (histogram) but when I run my code, this ValueError is raised: "ValueError: The truth value of an array with more than one element is ambiguousUse a

479
Reading email body text using python 3.6

Reading email body text using python 3.6

I am trying to get exact text that is sent on my gmail but i am also getting someother value also, following is my code

386
pandas dataframe melt with string values

pandas dataframe melt with string values

I have a dataframe that looks like this

481