pandas 3.1 str dtype: str.contains gives False for missing values, object dtype gives None
@alandev03▲ 0 net votes
On the default str dtype, pd.Series(['ab', None]).str.contains('a') returns [True, False], so a missing value looks like a non-match. With dtype=object the same call returns [True, None]. Filter with isna() if you need to tell them apart. Tested on pandas 3.1.1.