Plotten

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
TurbineWelt
User
Beiträge: 1
Registriert: Freitag 3. April 2015, 00:15

Mein Frage ist über ein Fehler: values = values[:, 2] NICHT RICHTIG! VIEL INDIZES sagt es....
(ICH BIN SEHR BEGINEER)

Code: Alles auswählen

values = np.genfromtxt(StringIO(csv_data), delimiter = ",")
values = values[:, 2]

stupidArray = [50, 100, 200, 300, 400]
master_results = []

for i, v in enumerate(values):
    master_results.append(master_func(v, stupidArray))

temp_array1 = []
temp_array2 = []
temp_array3 = []
temp_array4 = []
temp_array5 = []

for i in master_results:
    print i
    temp_array[0] = 1
    print temp_array[0]
    temp_array[1].append(i[1])
    temp_array[2].append(i[2])
    temp_array[3].append(i[3])
    temp_array[4].append(i[4])
    
for i in temp_array:
    plt.plot(i[0])
    plt.plot(i[1])
    plt.plot(i[2])
    plt.plot(i[3])
    plt.plot(i[4])

plt.ylabel('some numbers')
plt.show()
Zuletzt geändert von Anonymous am Freitag 3. April 2015, 12:50, insgesamt 1-mal geändert.
Grund: Quelltext in Python-Code-Tags gesetzt.
Sirius3
User
Beiträge: 18335
Registriert: Sonntag 21. Oktober 2012, 17:20

@TurbineWelt: Dann wird wohl csv_data nur eine Spalte enthalten. Der Rest vom Code enthält auch noch Fehler und wenn man numpy benutzt würde man das auch nicht so kompliziert schreiben, weil numpy-Arrays die Indizierung von ganzen Spalten und Zeilen erlaubt.
Antworten