I have a lot of txt, I want to read it, and plus them(every txt have same shape of array)
for i in base_n:
dfp_base=np.loadtxt(base_n,skiprows=2,usecols=(1,2,3))
dfp_base+=dfp_base
print dfp_base
but it's will only plus the end of files
I try to assign a variable but it's will give me an error
for i in base_n:
dfp_base=np.loadtxt(base_n,skiprows=2,usecols=(1,2,3))
dfp_base_s+=dfp_base
print dfp_base_s
UnboundLocalError: local variable 'dfp_base_s' referenced before assignment
how to fix it?
EDIT i define a zero array and solve this problem
dfp_base_s=np.zeros(shape=(30,3))
dfp_base_s?