Reputation: 21
I am trying to convert all true values in array 'v' to their actual numbers. Any suggestions would be highly appreciated.
import numpy as np
from numpy import load
dict_data = load('E_starData.npz')
EStar = dict_data['arr_0']
v = np.greater(EStar, 0.1)
print(v) #prints an array of true and false values, would like to display true values as the actual number
The code is pulling a saved zip file with all the data.
Upvotes: 0
Views: 91
Reputation: 342
There are probably better ways to approach the problem from the start, but building off of your code:
print([val for bool, val in zip(v, Estar) if bool])
Upvotes: 0