0
Year A1 A2 A3 Tier
1992 Sal Ray Tom 5
2003 Tom Peter Vick 3
2001 Ray Jill Kim 4
1998 Vick Sal Ray 2
1996 Peter Kim Sal 3
2002 Tom Kim Peter 2
  • How can a I create 3 new columns that takes each person regardless of which column they are in in order by year and outputs a running Tier average without using the current Tier. If its the first time appearing then all 1's. All new columns for year 1992 will be 1's.

  • answer should be

  • column A1r =[1,1,1,3.5,5,3]

  • column A2r =[1,1,4,1,3.5,2.5]

  • column A3r =[1,5,5,3,3,2]

  • Kindly post your expected dataframe – sammywemmy Mar 10 '21 at 06:53
  • 1
    you can calculate moving average in pandas using [pandas.DataFrame.rolling](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rolling.html) also [here](https://stackoverflow.com/questions/40060842/moving-average-pandas) – Shijith Mar 10 '21 at 06:58

0 Answers0