Boolean types
A Boolean type represents a value that is either True or False. Boolean data types are useful to simply answer questions with a yes/no style of response and are also widely used in machine learning algorithms to convert categorical values into 1s and 0s (for True and False, respectively) that a computer can more easily digest (see also the One-hot encoding with pd.get_dummies recipe in Chapter 5, Algorithms and How to Apply Them).
How to do it
For Boolean, the appropriate dtype= argument is pd.BooleanDtype:
pd.Series([True, False, True], dtype=pd.BooleanDtype())
0 True
1 False
2 True
dtype: boolean
The pandas library will take care of implicitly converting values to their Boolean representation for you. Often, 0 and 1 are used in place of False and True, respectively:
pd.Series([1, 0, 1], dtype=pd.BooleanDtype())
0 True
1 False
2 True
dtype: boolean
Once again, pd.NA is the canonical missing indicator, although...