I am new dummy to python…please help me in the following problem
I have a data in *.txt format as 4 colums name|items| a1| a2|, here I am interested only in 3rd and 4th column. Items column goes like a set [1,1], [12,12,2] etc., I need to open the text file, read the file and group all similar items colums in one array, find the maximum of that array, and then take an average of all the arrays which are formed with similar items. Finally I will get 1 value which is average of the individual maximum in an array.
eg., items [1,1]= [55,66]
greatest of items [1,1] is 66
items [12, 12] = [56 89 88]
greatest of items [12, 12,2] is 89
item [23 23 23] = [45, 33, 33.5]
greatest of items [23 23 23] is 45
average = maximum of items([1,1]+[12, 12]+........+[23 23 23]) = (66+89+...+45/ n) = x
where n is the total no: of similar items, for instance here it’s 6.
name items a1 a2
sty1 1 12 55sty1 1 2 66 sty1 12 5 56 sty1 12 12 89 sty1 12 2 88 sty1 2 5 78 sty1 31 5 45 sty1 31 1 45 sty1 31 3 45 sty1 31 8 45 sty1 4 23 45 sty1 4 12 45 sty1 23 31 45sty1 23 1 33 sty1 23 2 33.5
1 Answer