test = pd.DataFrame({"fruit":["apple","banana","melon", "grape"], "num":[1, 2, 3, np.nan], "human":["kim","ju", "Lee", "Gyeong"]})
test[test.isna().any(axis=1)].loc[:, "num"] = 4
test
It is very simple code. I want to change the row [grape, np.nan, "Gyeong"] to ["grape", 4, "Gyeong"]. However, it does not work. It does not change at all.. haha
How can I solve this problem?