Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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.

Browse Categories

...