Script to find the average of a given column and also for specified number of rows?

Hi Friends,

In continuation to my earlier post

I am extending my problem as follows.
Input:
Column1 Column2
MAS 1
MAS 4
MAS 7
Delhi 10
Delhi 13
Delhi 16
Delhi 20
Mumbai 22
Mumbai 67
..................................
.................................. so on. In my file I have 10000 rows.
I need to get the average of col2 for each unique key in col1 along with count of unique keys. By this way I should get the following output
MAS, 3, 4.0
Delhi,4, 14.75
Mumbai,2, 44.5
......... and so on.,

I need an automated script for this as I have 1000's of entries in Column 1 because it is almost impossible to put each key in script itself.
So I request you to please modify the below script to meet to my requirement.

awk '/^MAS/ || /^Delhi/ { ++n; sum += $3 } END { print sum / n }' Input_file

Thanks in advance..

awk 'NR>1{a[$1]++;b[$1]+=$2}END{for(i in a)printf "%s,%d,%.2f\n",i,a,(b/a)}' infile

For anything else please post on special homework subforum.

Thank you very much Danmero.. it works very well.