Python Forum
Automating to generate multiple arrays - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Automating to generate multiple arrays (/thread-30768.html)



Automating to generate multiple arrays - Robotguy - Nov-04-2020

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) 



RE: Automating to generate multiple arrays - Gribouillis - Nov-05-2020

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