TypeError: Nur Arrays der Länge 1 können in Python-Skalare konvertiert werden, während der Plot @ anzeig
Ich habe einen solchen Python-Code:
import numpy as np
import matplotlib.pyplot as plt
def f(x):
return np.int(x)
x = np.arange(1, 15.1, 0.1)
plt.plot(x, f(x))
plt.show()
Und ein solcher Fehler:
TypeError: only length-1 arrays can be converted to Python scalars
Wie kann ich es reparieren