related lists mean value

Steve Howell showell30 at yahoo.com
Tue Mar 9 11:29:44 EST 2010


On Mar 8, 2:34 pm, dimitri pater - serpia <dimitri.pa... at gmail.com>
wrote:
> Hi,
>
> I have two related lists:
> x = [1 ,2, 8, 5, 0, 7]
> y = ['a', 'a', 'b', 'c', 'c', 'c' ]
>
> what I need is a list representing the mean value of 'a', 'b' and 'c'
> while maintaining the number of items (len):
> w = [1.5, 1.5, 8, 4, 4, 4]
>

What results are you expecting if you have multiple runs of 'a' in a
longer list?



More information about the Python-list mailing list