1

I have a dataset, df, where I would like to convert values in specific columns to the string: TRUE, if it contains 1 and FALSE if it contains 0.

Data

Id    group

1     0
1     1

Desired output

 Id    group

   TRUE  FALSE
   TRUE  TRUE

Doing

  df[['Id', 'group']].replace([0]), 'False')

Any suggestion is appreciated.

Lynn
  • 4,292
  • 5
  • 21
  • 44

0 Answers0