/ / criação de novos arrays multidimensionais - python, numpy

criação de um novo array multidimensional - python, numpy

Eu tenho 10 1 arrays em 10 arquivos diferentes.

file 1 vx=[0,1,2.....525]
file 2 vx=[0,1,2.....525]
.
.
.
.
.
.
.
.
file 10 vx=[0,1,2......525]

Agora eu quero criar uma nova matriz que contenha todos os arrays na seguinte ordem,

newarray=[[f1arrays],[f2arrays],.......[f10arrays]]

Eu também preciso criar outro novo array onde f1, f2..f10 arrays será a diferença entre 2 índice consecutivo.

newarray2=[[latestf1array],[latest2array],.......[latest10arrays]]
where these latestarrays= [difference between two consecutive numbers for all 525 number]

Respostas:

0 para resposta № 1
import numpy as np

#read your 10 arrays and add them to the list all_arrays. The following line just generate some fake data.
all_arrays = [np.random.randint(0,10,526) for i in range(10)]

#combine your 10 arrays to a single array
newarray = np.r_[all_arrays]

#Get difference between two consecutive numbers for all 526 numbers for all of your 10 arrays. Note: Last elemetn in each array remains unchanged.
newarray2 = np.r_[[np.r_[a[1:]-a[:-1],a[-1]] for a in all_arrays]]