title: How to create a rolling mean column in pandas for different subset elements?
body: <p>I have a Pandas dataframe that looks like this:</p>
  <pre><code>| PLAYER  | DATE       | SCORE | GAME | 
  |---------|------------|-------|------|
  | Albert  | 2020-08-12 | 10    | X    |
  | Barney  | 2020-08-12 | 100   | X    |
  | Charlie | 2020-08-12 | 1000  | X    |
  | Albert  | 2020-08-13 | 20    | X    |
  | Barney  | 2020-08-13 | 200   | X    |
  | Charlie | 2020-08-13 | 2000  | X    |
  | Albert  | 2020-08-14 | 30    | Y    |
  | Barney  | 2020-08-14 | 300   | Y    |
  | Charlie | 2020-08-14 | 3000  | Y    |
  | Albert  | 2020-08-15 | 40    | Y    |
  | Barney  | 2020-08-15 | 400   | Y    |
  | Charlie | 2020-08-15 | 4000  | Y    |
  | Albert  | 2020-08-16 | 50    | Z    |
  | Barney  | 2020-08-16 | 500   | Z    |
  | Charlie | 2020-08-16 | 5000  | Z    |
  | Albert  | 2020-08-17 | 60    | Z    |
  | Barney  | 2020-08-17 | 600   | Z    |
  | Charlie | 2020-08-17 | 6000  | Z    |
  </code></pre>
  <p>I`m trying to create a new column with 2-day score averages for each player as a subset, so that I get the following result:</p>
  <pre><code>| PLAYER  | DATE       | SCORE | GAME | 2-DAY AVG |
  |---------|------------|-------|------|-----------|
  | Albert  | 2020-08-12 | 10    | X    | NaN       |
  | Barney  | 2020-08-12 | 100   | X    | NaN       |
  | Charlie | 2020-08-12 | 1000  | X    | NaN       |
  | Albert  | 2020-08-13 | 20    | X    | 15        | 
  | Barney  | 2020-08-13 | 200   | X    | 150       |
  | Charlie | 2020-08-13 | 2000  | X    | 1500      |
  | Albert  | 2020-08-14 | 30    | Y    | 25        |
  | Barney  | 2020-08-14 | 300   | Y    | 250       |
  | Charlie | 2020-08-14 | 3000  | Y    | 2500      |
  | Albert  | 2020-08-15 | 40    | Y    | 35        |
  | Barney  | 2020-08-15 | 400   | Y    | 350       |
  | Charlie | 2020-08-15 | 4000  | Y    | 3500      |
  | Albert  | 2020-08-16 | 50    | Z    | 45        |
  | Barney  | 2020-08-16 | 500   | Z    | 450       |
  | Charlie | 2020-08-16 | 5000  | Z    | 4500      |
  | Albert  | 2020-08-17 | 60    | Z    | 55        |
  | Barney  | 2020-08-17 | 600   | Z    | 550       |
  | Charlie | 2020-08-17 | 6000  | Z    | 5500      |
  
  </code></pre>
  <p>I've searched stack overflow and tried several combinations of code using <code>groupby()</code> with <code>rolling.mean(2)</code> functions, along with python conditional statements, but failed to do so.</p>
  <p>Is there a clever way to do it in Pandas?</p>