Conditionally replace dataframe cells with value from another cell
Aha! For some reason, when I named a variable that pointed to a value in a dataframe, and then tried to use the variable to put it back into the table replacing other cells, it changed the dtype. That's why I was getting NaNs. I just had to convert it to a usable type using tolist.

As for the nearest-value identification, this seems to have worked:

Pfinal = df.iloc[(df['P']-Plithos).abs().idxmin()]

F_max = Pfinal[1]

F_max = F_max.tolist()

df.loc[(df['P'] &lt; Plithos),['F']] = F_max