Python Forum

Full Version: Automating to generate multiple arrays
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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) 
Robotguy Wrote:Any suggestions?
Use a dict instead
hist = {}
for i in range(5):
    hist[i] = np.zeros(8192, np.uint64)