Python Forum
Automating to generate multiple arrays
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automating to generate multiple arrays
#1
I have a for loop and have to create a new histogram every time it executes (hist1, hist2, ...). I tried the below but it isn't working. Any suggestions?

for i in range(5):
    f'hist{i}' = np.zeros(8192, np.uint64) 
Reply
#2
Robotguy Wrote:Any suggestions?
Use a dict instead
hist = {}
for i in range(5):
    hist[i] = np.zeros(8192, np.uint64)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  comparing floating point arrays to arrays of integers in Numpy amjass12 0 1,613 Jul-26-2021, 11:58 AM
Last Post: amjass12
  Automating PyTables Dataset Creation and Append Robotguy 1 1,768 Oct-18-2020, 08:35 PM
Last Post: jefsummers
  Automating to save generated data Robotguy 3 2,229 Aug-12-2020, 03:32 PM
Last Post: Robotguy
  Numpy arrays and compatability with Fortran arrays merrittr 0 1,849 Sep-03-2019, 03:54 AM
Last Post: merrittr
  Newbie question: how to generate dataframe and use multiple regression zydjohn 0 2,252 Dec-10-2017, 09:49 AM
Last Post: zydjohn
  Automating the code using os.walk kiton 20 14,162 Apr-13-2017, 06:15 PM
Last Post: kiton

Forum Jump:

User Panel Messages

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