Year Price
2010 60.000
2010 70.000
2010 nan
2009 92.000
2008 160.000
2008 nan
2008 87.000
I want to replace the nan values with the average prices of the years they belong to. I want my output something like this:
Year Price
2010 60.000
2010 70.000
2010 65.000
2009 92.000
2008 160.000
2008 123.500
2008 87.000
How can I get it?