I am attempting to create a function which compares data from multiple files. The files are chosen through a dialog window (from GUI platform Tkinter)
def compare_datafiles(file_name):
data = np.genfromtxt(file_name, dtype=float, delimiter=',', skiprows=(2), usecols=(1,2,3,4,5,6), skip_footer=(3))
initial = data[0,:]
final = data[-1,:]
weightDiff=final-initial
data=np.row_stack((data, weightDiff))
totalWD=sum(data[4,:]) # calculate total weight
distr=np.round((weightDiff/totalWD),2)
print distr
return distr
for x in selectedFiles:
M = compare_datafiles(x)
When I run the function with two input files, it prints two arrays:
runfile(r'C:\Users...)
[ 0.23 0.04 0.1 0.14 0.12 0.38]
[ 0.22 0.05 0.13 0.16 0.12 0.32]
But only returns one of them:
M
array([ 0.22, 0.05, 0.13, 0.16, 0.12, 0.32])
How can I get it to return both of the arrays?