Feb-02-2020, 01:57 AM
(This post was last modified: Feb-02-2020, 01:58 AM by SchroedingersLion.)
Hello guys,
I would like to know why the following does not give me an Nx7 array.
I obtain a 1d array, instead of N x 7.
I would like to know why the following does not give me an Nx7 array.
X_y_disch = np.empty((0,7), float) for keys in B1_B2: X_y_disch = np.append(X_y_disch, [[k for k in B1_B2[keys]["Discharge-Model"].values()] + [B1_B2[keys]["Cycle Life"][0,0]]])where B1_B2 is a nested dictionary. Each k in the "k for k" loop yields a float, i.e.
[k for k in B1_B2[keys]["Discharge-Model"].values()]is a list of N-1 floats.
B1_B2[keys]["Cycle Life"][0,0]yields a float as well.
I obtain a 1d array, instead of N x 7.