Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
append list to empty array
#2
I found the solution: One has to specify axis=0 in order to get what I want, otherwise the arrays are flattened before appending is performed.

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]]], axis=0)
Reply


Messages In This Thread
append list to empty array - by SchroedingersLion - Feb-02-2020, 01:57 AM
RE: append list to empty array - by SchroedingersLion - Feb-02-2020, 05:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  append str to list in dataclass flash77 6 486 Mar-14-2024, 06:26 PM
Last Post: flash77
  Code with empty list not executing adeana 9 3,742 Dec-11-2023, 08:27 AM
Last Post: buran
Question How to append integers from file to list? Milan 8 1,454 Mar-11-2023, 10:59 PM
Last Post: DeaD_EyE
  functional LEDs in an array or list? // RPi user Doczu 5 1,609 Aug-23-2022, 05:37 PM
Last Post: Yoriz
  read a text file, find all integers, append to list oldtrafford 12 3,594 Aug-11-2022, 08:23 AM
Last Post: Pedroski55
  set.difference of two list gives empty result wardancer84 4 1,507 Jun-14-2022, 01:36 PM
Last Post: wardancer84
  Using .append() with list vs dataframe Mark17 7 10,490 Jun-12-2022, 06:54 PM
Last Post: Mark17
  displaying empty list vlearner 5 1,682 Jan-19-2022, 09:12 AM
Last Post: perfringo
  Remove empty keys in a python list python_student 7 3,038 Jan-12-2022, 10:23 PM
Last Post: python_student
  How to append multiple <class 'str'> into a single List ahmedwaqas92 2 2,338 Jan-07-2021, 08:17 AM
Last Post: ahmedwaqas92

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020