Skip to content

pd.concat(objs) drops type of the inputs if all inputs are empty #7024

Closed
@OlexiyO

Description

@OlexiyO

When concatenating several pd.Series of the same type, I would expect the output Series to have the same type. However, this does not hold if all input Series are empty:

In [0]: x = pd.Series([], dtype=int)
In [1]: pd.concat([x, x])
Series([], dtype: object)

How I would expect it to work:
pd.concat([x, x]) should return Series([], dtype=int)

Just as an example, this works fine:

In [2]: y = pd.Series([1], dtype=int)
In [3]: pd.concat([y, y])  # This works fine:
0    1
0    1
dtype: int64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions