1

I have a dataframe in which I have to do the following:

I have to change the values that are null in the column df["a"] change them by dividing the values of the column df["b"]/df["c "] df["a"] =df["b"]/df["c"] and if this value is not null leave it as is.

But before that I have to select the values that are different from "USD" and NAN in the column df["e"], what I proposed was the following:

if  (df['e'].notnull()) | (df['e']!= 'USD') & (df['a'].isnull()):
    df['a']=(df['b']/ df['ac']) 
else:
    df['a']= df['a']
mousetail
  • 7,009
  • 4
  • 25
  • 45

0 Answers0