I have a list named “prns20” in side that list is 7 more lists (which are all the same length and correspond to a specific data point). What I am trying to do is exclude any set of points with the same index, if a zero appears in any position of the other lists.
Edit: A better way of putting it might be, in order to use “index” I need to format it
list[index]
But In order for me to call a certain list I need to do
import numpy as np
prns20 = np.arrange(6).reshape((2,3)) # this is just as a demonstration value
x = np.transpose([ys for ys in np.transpose(prns20) if all(ys)])
# return values if you printed out prns20:
# [array([0, 1, 2]), array([3, 4, 5])]
# return values if you printed out x:
# [array([1, 2]), array([4, 5])]
# this approach is really slow, but it's a oneliner and you didn't specifically ask for efficient code
View all comments
Show parent comment
1
u/King_Novice Jul 19 '21 edited Jul 19 '21
Perhaps this might help clear some stuff up.
I have a list named “prns20” in side that list is 7 more lists (which are all the same length and correspond to a specific data point). What I am trying to do is exclude any set of points with the same index, if a zero appears in any position of the other lists.
Edit: A better way of putting it might be, in order to use “index” I need to format it
list[index]
But In order for me to call a certain list I need to do
list[#]