Geister-Array ?!?
Verfasst: Samstag 5. September 2020, 18:22
Hallo Leute,
ich gebe Arrays per Dateieinlesung vor und möchte diese dann mit einem bestimmten Start-Array zusammenzufügen.
Bei der Vorgabe aus einer Datei funktioniert dies. Bei drei Dateien erhielt ich "ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 0 dimension(s)" als Fehlermeldung.
Bei der Fehlersuche fiel mir dann auf, dass ich ein Array zur Verfügung habe, welches zu dem Zeitpunkt nicht existieren sollte. Und dann auch noch "falsch" ist, da diese Datei so zu dem Punkt nicht existiert. Sozusagen ein Geister-Array.
Wieso ist es dort?
So gibts die Fehlermeldung:
So erhalte ich das "isosorbid_conc"-Array obwohl es nicht existieren sollte:
ich gebe Arrays per Dateieinlesung vor und möchte diese dann mit einem bestimmten Start-Array zusammenzufügen.
Bei der Vorgabe aus einer Datei funktioniert dies. Bei drei Dateien erhielt ich "ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 0 dimension(s)" als Fehlermeldung.
Bei der Fehlersuche fiel mir dann auf, dass ich ein Array zur Verfügung habe, welches zu dem Zeitpunkt nicht existieren sollte. Und dann auch noch "falsch" ist, da diese Datei so zu dem Punkt nicht existiert. Sozusagen ein Geister-Array.
Wieso ist es dort?
So gibts die Fehlermeldung:
Code: Alles auswählen
########################## Daten einlesen ################################
data_sorbitol = np.genfromtxt("Sorbitol.csv", delimiter = ";")
data_isosorbid = np.genfromtxt("Isosorbid.csv", delimiter = ";")
x, name, conc_sorbitol = data_sorbitol.T
x, name, conc_isosorbid = data_isosorbid.T
########################## Startvorgabe #####################################
m_sorbitol = 2000
m_ansatz = 22.4
start_sorbitol = np.array([m_sorbitol / m_ansatz])
start_isosorbid = np.array([0])
########################## Zusammenschluss ###################################
conc_sorbitol = np.array([conc_sorbitol])
conc_isosorbid = np.array([conc_isosorbid])
sorbitol_conc = np.concatenate((start_sorbitol, conc_sorbitol))
isosorbid_conc = np.concatenate((start_isosorbid, conc_isosorbid))
print(isosorbid_conc)
print(sorbitol_conc)
print(conc_isosorbid)
print(start_isosorbid)
print(start_isosorbid.shape)
print(conc_sorbitol.shape)
print(conc_isosorbid.shape)
print(isosorbid_conc.shape)
print(sorbitol_conc.shape)
Code: Alles auswählen
########################## Daten einlesen ################################
data_sorbitol = np.genfromtxt("Sorbitol.csv", delimiter = ";")
data_isosorbid = np.genfromtxt("Isosorbid.csv", delimiter = ";")
x, name, conc_sorbitol = data_sorbitol.T
x, name, conc_isosorbid = data_isosorbid.T
########################## Startvorgabe #####################################
m_sorbitol = 2000
m_ansatz = 22.4
start_sorbitol = np.array([m_sorbitol / m_ansatz])
start_isosorbid = np.array([0])
########################## Zusammenschluss ###################################
conc_sorbitol = np.array([conc_sorbitol])
conc_isosorbid = np.array([conc_isosorbid])
#sorbitol_conc = np.concatenate((start_sorbitol, conc_sorbitol))
#isosorbid_conc = np.concatenate((start_isosorbid, conc_isosorbid))
print(isosorbid_conc)
print(sorbitol_conc)
print(conc_isosorbid)
print(start_isosorbid)
print(start_isosorbid.shape)
print(conc_sorbitol.shape)
print(conc_isosorbid.shape)
print(isosorbid_conc.shape)
print(sorbitol_conc.shape)