Q:

Calculating expanding mean on 2 columns simultaneously

I have a table of 2 players competing each other:
    date         plA    plB    ptsA ptsB
0   01/01/2013  Jeff    Tom     78  72
1   15/01/2013  Jeff    Tom     52  67
2   01/02/2013  Tom     Jeff    91  93
3   15/02/2013  Jeff    Tom     83  87
4   01/03/2013  Tom     Jeff    65  76

I want to apply the expanding mean, such that ptsA and ptsB for each player get counted in (and are not left) to the net result. Final output should make it more clear:
    date         plA    plB    ptsA ptsB   meanA  meanB 
0   01/01/2013  Jeff    Tom     78  72      78     72      # init mean
1   15/01/2013  Jeff    Tom     52  67      65     69.5 
2   01/02/2013  Tom     Jeff    91  93      74.3   76.6    # Tom: (72+67+91)/3, Jeff: (78+52+93)/3
3   15/02/2013  Jeff    Tom     83  87      76.5   79.25   # Jeff: (78+52+93+83)/4, Tom: (72+67+91+87)/4
4   01/03/2013  Tom     Jeff    65  76      76.4   76.4    # Tom: (72+67+91+87+65)/5, Jeff: (78+52+93+83+76)/5

Now, I started grouping data by plA and like this:
by_A = players.sort(columns='date').groupby('plA')
players['meanA'] = by_A['ptsA'].apply(pd.expanding_mean)
players['meanB'] = by_A['ptsB'].apply(pd.expanding_mean)

and obviously, I need to do the same, and groupby('plB') and then Im drawing a blank how to join these two results correctly. 
Perhaps pandas offers a built-in or you have a solution for it? 
@EDIT Saullo Castro's solution with slightly different data
    date    studentA    studentB    scoreA  scoreB  meanJeff    meanTom     meanMaggie
0   2013-01-01  Jeff    Tom     78  72             78.000000    72.000000   0.000000
1   2013-01-15  Jeff    Maggie  52  67             65.000000    36.000000   33.500000
2   2013-02-01  Tom     Jeff    91  93             74.333333    54.333333   22.333333
3   2013-02-15  Jeff    Tom     83  87             76.500000    62.500000   16.750000
4   2013-03-01  Tom     Jeff    65  76             76.400000    63.000000   13.400000

Maggie's mean should stay 67 all the way.

A:

(Please, refer to the fixed solution below)
One approach is to find out all the player's names first:
names = pd.concat((df.plA, df.plB)).unique()

Then create one new column with the expanding mean for each player:
for name in names:
    df['mean'+name] = pd.expanding_mean(df.ptsA*(df.plA==name) + df.ptsB*(df.plB==name))

Resulting in:
                  date   plA   plB  ptsA  ptsB   meanJeff    meanTom
0  2013-01-01 00:00:00  Jeff   Tom    78    72  78.000000  72.000000
1           15/01/2013  Jeff   Tom    52    67  65.000000  69.500000
2  2013-01-02 00:00:00   Tom  Jeff    91    93  74.333333  76.666667
3           15/02/2013  Jeff   Tom    83    87  76.500000  79.250000
4  2013-01-03 00:00:00   Tom  Jeff    65    76  76.400000  76.400000

EDIT: Fixed solution:
For more than two names this is how you can build the formula for the expanding mean:
df = pd.read_excel('stack.xlsx', 'tabelle1')
names = pd.concat((df.plA, df.plB)).unique()
for name in names:
    nA = df.plA==name
    nB = df.plB==name
    df['mean'+name] = np.cumsum(df.ptsA*nA + df.ptsB*nB)/np.maximum(1.,
                                     np.cumsum(1.*np.logical_or(nA, nB)))

Resulting in:
date   plA     plB  ptsA  ptsB   meanJeff    meanTom  meanMaggie
0 2013-01-01 00:00:00  Jeff     Tom    78    72  78.000000  72.000000     0
1 2013-01-15 00:00:00  Jeff  Maggie    52    67  65.000000  72.000000    67
2 2013-02-01 00:00:00   Tom    Jeff    91    93  74.333333  81.500000    67
3 2013-02-15 00:00:00  Jeff     Tom    83    87  76.500000  83.333333    67
4 2013-03-01 00:00:00   Tom    Jeff    65    76  76.400000  78.750000    67

