The Python Oracle

Python replace 1.0 and 0.0 with True and False in dataframe

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Peaceful Mind

--

Chapters
00:00 Python Replace 1.0 And 0.0 With True And False In Dataframe
00:23 Accepted Answer Score 6
00:32 Thank you

--

Full question
https://stackoverflow.com/questions/6338...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #pandas #dataframe #replace

#avk47



ACCEPTED ANSWER

Score 6


Try with bool :-)

df.A=df.A.astype(bool)
df
Out[69]: 
       A
0   True
1  False
2   True
3  False