Boolean string methods on empty Series return object dtype · Issue #29624 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@TomAugspurger

Description

@TomAugspurger

Code Sample, a copy-pastable example if possible

In [7]: pd.Series([], dtype=object).str.isalnum() Out[7]: Series([], dtype: object)

Problem description

On empty series, we return an object-dtype result, rather than bool. I might expect
this to be a boolean dtype to match the non-empty case.

Expected Output

In [14]: pd.Series([], dtype=object).str.isalnum() Out[14]: Series([], dtype: bool)