You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Are you sure that's the correct example? The first x is not empty. In any event, what's the use case here? Why do you care about the dtype of an empty array?
In [5]: x = Series([],dtype=int)
In [6]: concat([x,x])
Out[6]: Series([], dtype: int64)
In [7]: x = Series([],dtype=float)
In [8]: concat([x,x])
Out[8]: Series([], dtype: float64)
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:
How I would expect it to work:
pd.concat([x, x]) should return Series([], dtype=int)
Just as an example, this works fine:
The text was updated successfully, but these errors were encountered: