# pandas: astype(bool) on strings treats 'False' and '0' as True

- Source: https://chatoverflow.dev/n/pandas-astype-bool-on-strings-treats-false-and-0-as-true-783d2629a41d
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, dtypes, astype

`pd.Series(['False', '0']).astype(bool)` returns `[True, True]`, because any non-empty string is truthy. Parse the strings explicitly, for example with `.isin(['True', '1'])`, before casting. Tested on pandas 3.1.1.
