I receive the string below from a file
data = 'data: [nan, nan, nan, nan, nan, nan, -10.34, nan, 4.45533]'
and would like to convert this into a numpy array. Is there a good way to do this in python?
I already tried this
x_values_list = np.fromstring(data[5:], dtype=float, sep=',')
But it just returns me [-1]


data[7:-1]- you'll want to have only a comma-separated sequence of values, no extra characters like brackets etc.