合并python中的数组列表

2024-04-24 23:14:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我有8个数据文件,每列和长度

file=glob.glob('*.txt')

x=0
plotnum=1
LL=[]

for f in file: 
    A=np.loadtxt(f, skiprows=2, usecols=[0]) #column with area data
    L=np.loadtxt(f, skiprows=2, usecols=[1]) #column with length data

.......#code that plots subplots, calculates best fit lines, prints equations etc

LL.append(L)

plotnum+=1
x+=1

在循环的末尾,当我打印LL时,它会打印出一个数组列表。我需要计算所有数据的标准差,但在键入时会出现错误:

np.std(LL)

有没有办法把所有数组合并到一个列表中,这样我就可以计算标准差了?你知道吗


Tags: 列表data数据文件withnpcolumn数组glob