-1

I want to create a new column called Book in which I take data from a column called Exposure. If the value from the exposure column is 0, I want it to return 100, else I want to retain the same value. This is what I've already tried:

df['Book'] = np.where(df['Exposure']==0,100,)

how do I get it to return the same value if it's not zero?

R4444
  • 2,016
  • 2
  • 19
  • 30
Andreas
  • 35
  • 1
  • 5

1 Answers1

0

Try this :

df['Book'] = df['Exposure'].replace(0, 100)
Jerome
  • 16
  • 3