reading, grouping, finding average
<p>I am new dummy to python...please help me in the following problem</p>

<p>I have a data in *.txt format as 4 colums <code>name|items| a1| a2|</code>, here I am interested only in 3rd and 4th column. Items column goes like a set <code>[1,1]</code>, <code>[12,12,2]</code> 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.</p>

<p>eg., <code>items [1,1]= [55,66]</code></p>

<p>greatest of items <code>[1,1]</code> is <code>66</code></p>

<p>items <code>[12, 12]</code> = <code>[56 89 88]</code></p>

<p>greatest of items <code>[12, 12,2]</code> is <code>89</code></p>

<p>item <code>[23 23 23]</code> = <code>[45, 33, 33.5]</code></p>

<p>greatest of items <code>[23 23 23]</code> is <code>45</code></p>

<p>average = maximum of items(<code>[1,1]+[12, 12]+........+[23 23 23]</code>) = (<code>66+89+...+45/ n</code>) = <code>x</code></p>

<p>where n is the total no: of similar items, for instance here it's 6.</p>

<blockquote>
  <blockquote>
    <blockquote>
      <h1>name    items    a1       a2</h1>

<pre><code>sty1    1      12      55
</code></pre>
    </blockquote>

<pre><code>sty1    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     45
</code></pre>
  </blockquote>

<pre><code>sty1   23      1      33 

sty1   23      2      33.5
</code></pre>
</blockquote>
