0

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
  • 3,332
  • 2
  • 15
  • 25

0 Answers0