I have a large dataset and the shorter version of that is as below
Col1 Col2
0 1
1 0.9971
4 NA
6 NA
7 NA
14 NA
18 0.9951
22 NA
25 NA
46 0.9941
57 NA
59 NA
60 0.9921
For those missing values in Col2, I want the NAs replaced with the value above it from the same column Col2. The final dataset would look like this below.
Col1 Col2
0 1
1 0.9971
4 0.9971
6 0.9971
7 0.9971
14 0.9971
18 0.9951
22 0.9951
25 0.9951
46 0.9941
57 0.9941
59 0.9941
60 0.9921