I was trying to write a programm using numpy and matplotlib. I am new to python programming. The code I wrote is:
import numpy
import matplotlib.pyplot
def ThisFunction(a):
return numpy.int(a)
a = numpy.arange(3, 13.5, 0.7)
matplotlib.pyplot.plot(a, ThisFunction(a))
matplotlib.pyplot.show()
And it gives me error:
Traceback (most recent call last):
File "main.py", line 7, in <module>
matplotlib.pyplot.plot(a, ThisFunction(a))
File "main.py", line 4, in ThisFunction
return numpy.int(a)
TypeError: only size-1 arrays can be converted to Python scalars
how can I solve this problem?