Skip to content

Tag: arrays

Pop multiple items from the beginning and end of a list

Suppose I have a list of items like this: I want to pop two items from the left (i.e. a and b) and two items from the right (i.e. h,i). I want the most concise an clean way to do this. I could do it this way myself: Any other alternatives? Answer From a performance point of view: mylist =

Remove rows in 3D numpy array

I need to remove some rows from a 3D numpy array. For exampe: and I want to remove the third row of both pages of the matrix in order to obtain something like: I have tried with but I can’t obtain what I need. Answer axis should 1.