0

Python: Replacing Values using other rows data

Please assist, I have this form of data.

enter image description here

I want to do replacement such that null values in 'Value1' column are duplicated as long the rows have the same 'C_Code' value regardless of any other columns. Same for 'Value2' null values. They can duplicate the non-null value for closest "Year" (not a must). My table has many columns requiring this treatment.

Expected output:

enter image description here

petezurich
  • 9,280
  • 9
  • 43
  • 57
user3087182
  • 63
  • 1
  • 1
  • 8

0 Answers0