Here is a example of what i mean.
Code Name Value
1 Fred 2
2 Gary 2
1
2
I want to fill name and value by his respective code. In this case, Fred in the third row and Gary in the fourth row. Regards.
Here is a example of what i mean.
Code Name Value
1 Fred 2
2 Gary 2
1
2
I want to fill name and value by his respective code. In this case, Fred in the third row and Gary in the fourth row. Regards.
Try with groupby with ffill
df.update(df.groupby('Code').ffill())
df
Out[94]:
Code Name Value
0 1 Fred 2.0
1 2 Gary 2.0
2 1 Fred 2.0
3 2 Gary 2.0