1

I would like to add a new column (named 'sick') filled with "yes" in a DataFrame (df).

I tried the following code but this is not working:

df['sick']=print(df['sick']=="yes")

Do you have any suggestions please?

Dan
  • 45,079
  • 17
  • 88
  • 157
cladev
  • 11
  • 4
  • 2
    df['sick'] = 'yes' – PV8 Jun 21 '19 at 12:41
  • the `print` function is only to print a result to the console. You would never use it for an assignment. You can just assign the value to the column directly as the other answers have indicated. – Dan Jun 21 '19 at 12:45

0 Answers0