Skip to content

Series.str.cat() with NaN in series returns NaN, rather than ignoring NaN #11435

Closed
@hack-c

Description

@hack-c

I find this surprising as the rest of the pandas Series.str.* API ignores NaN values.

In [1]: import pandas as pd

In [2]: import numpy as np

In [3]: pd.__version__
Out[3]: u'0.17.0'

In [4]: s = pd.Series(['asdf','sdfg',np.nan,'qwer','wert'])

In [5]: s.str.cat(sep=' ')
Out[5]: nan

I think this should return

In [5]: s.str.cat(sep=' ')
Out[5]:'asdf sdfg qwer wert'

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions