numpy - Putting multiple columns into callable sub arrays python -


i have set of data in columns, first column x values. how read in?

if want store both, x , y values can do

ydat = np.zeros((data.shape[1]-1,data.shape[0],2))  # write x data ydat[:,:,0] = data[:,0]  # write y data     ydat[:,:,1] = data[:,1:].t 

edit: if want store y-data in sub arrays can do

ydat = data[:,1:].t 

working example:

t = np.array([[ 0.,  0.,  1.,  2.],               [ 1.,  0.,  1.,  2.],               [ 2.,  0.,  1.,  2.],               [ 3.,  0.,  1.,  2.],               [ 4.,  0.,  1.,  2.]])   = t[:,1:].t  array([[ 0.,  0.,  0.,  0.,  0.],        [ 1.,  1.,  1.,  1.,  1.],        [ 2.,  2.,  2.,  2.,  2.]]) 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -