File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 3
3
import pandas .core .dtypes .concat as _concat
4
4
5
5
import pandas as pd
6
- from pandas import Series
6
+ from pandas import Series , DataFrame
7
7
import pandas ._testing as tm
8
8
9
9
@@ -64,3 +64,21 @@ def test_concat_series_between_empty_and_tzaware_series(using_infer_string):
64
64
dtype = float ,
65
65
)
66
66
tm .assert_frame_equal (result , expected )
67
+
68
+
69
+ def test_concat_categorical_dataframes ():
70
+ df = DataFrame ({"a" : [0 , 1 ]}, dtype = "category" )
71
+ df2 = DataFrame ({"a" : [2 , 3 ]}, dtype = "category" )
72
+
73
+ result = pd .concat ([df , df2 ], axis = 0 )
74
+
75
+ assert result ["a" ].dtype .name == "category"
76
+
77
+
78
+ def test_concat_categorical_series ():
79
+ ser = Series ([0 , 1 ], dtype = "category" )
80
+ ser2 = Series ([2 , 3 ], dtype = "category" )
81
+
82
+ result = pd .concat ([ser , ser2 ], axis = 0 )
83
+
84
+ assert result .dtype .name == "category"
You can’t perform that action at this time.
0 commit comments