Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (12.7k points)

Can anyone tell me, How can I map True/False to 1/0 in a Pandas Dataframe? Is there any quick way to do that?

1 Answer

0 votes
by (26.4k points)

A compact method to change a single column of boolean qualities/values over to a section of integers 1 or 0:

df["somecolumn"] = df["somecolumn"].astype(int)

Interested to learn python in detail? Come and Join the python course.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers

501 comments

104k users

Browse Categories

...