[Tutor] Python question

dn PythonList at DancesWithMice.info
Mon Apr 18 16:02:58 EDT 2022


Greetings,

On 18/04/2022 21.50, Eleonora Panini wrote:
> <https://stackoverflow.com/posts/71904558/timeline>
> 
> I need help to do the following steps in Phyton:
> 
> -my starting array is: array = np.random.rand(1024x11700)
> 
> -I have to obtain an array 1024x23400 with the following characteristics:
> 25 columns(1024x25) of data and 25 columns (1024x25) of zeros
> 
>  So I thought to do a loop every 25 columns(1024x25), insert an array of
> zeros (1024x25) alternatevely every 25 columns, so I obtain an array
> 1024x23400..
> 
> but I don't know how to do it in Phyton.. Can you help me? Thank you


This sounds very much like a homework assignment. Is it?

Please show us the pertinent code you have written so-far, and any
exception report. That way we can help you to improve...

How do you construct the first 25-columns (in Python)?
How do you construct the zero-ed columns?
How do you put the first pair of 25-column 'sets of data' together?
How would you repeat this for the requisite number of times/columns?

BTW this looks more like numpy than Python...
-- 
Regards,
=dn


More information about the Tutor mailing list