I am quite new to pandas and I have a dataframe as follows,
year A B
0 2000 101 20
1 2001 102 10
2 2002 103 5
3 2003 250 2
4 2004 500 4
I want to create new column ( column C) by dividing the column B row value by the row value just below it. As follows,
year A B C
0 2000 101 20 2
1 2001 102 10 2
2 2002 103 5 2.5
3 2003 250 2 0.5
4 2004 500 4
Not sure how to do it ( think for loop helps), Thanks