0

my aim is to add values to a column. In particular I want to add number only in the empty cells of this column. And these values are set with respect to another column. So I have to mix nan values with if condition, how can I do this? I know that I can use fillna or with replace, but i want to know how I can mix a if condition with fillna.

df["new"] = df["new"].str.replace('np.nan','0') if df['RadGLOBale']> 0.1 and df['RadGLOBale'] < 100 else df['new']. The error is this: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Donato
  • 1

0 Answers0