-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.ReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Milestone
Description
Was a little surprised by this behavior when combining frames with the string dtype and misaligned labels
In [2]: one = pd.DataFrame([["a"]], dtype="string", columns=["a"])
In [3]: two = pd.DataFrame([["b"]], dtype="string", columns=["b"])
In [4]: pd.concat([one, two]).dtypes
Out[4]:
a object
b object
dtype: object
A similar issue is exhibited with the integer types:
In [13]: one = pd.DataFrame([[1]], dtype="uint16", columns=["a"])
In [14]: two = pd.DataFrame([[2]], dtype="uint16", columns=["b"])
In [15]: pd.concat([one, two]).dtypes
Out[15]:
a float64
b float64
dtype: object
Occurs on master
Metadata
Metadata
Assignees
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.ReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode