2525 ABCIndexClass ,
2626 ABCPeriodIndex ,
2727 ABCRangeIndex ,
28- ABCSparseDataFrame ,
2928 ABCTimedeltaIndex ,
3029)
3130
@@ -71,41 +70,7 @@ def get_dtype_kinds(l):
7170 return typs
7271
7372
74- def _get_series_result_type (result , objs = None ):
75- """
76- return appropriate class of Series concat
77- input is either dict or array-like
78- """
79- from pandas import SparseSeries , SparseDataFrame , DataFrame
80-
81- # concat Series with axis 1
82- if isinstance (result , dict ):
83- # concat Series with axis 1
84- if all (isinstance (c , (SparseSeries , SparseDataFrame )) for c in result .values ()):
85- return SparseDataFrame
86- else :
87- return DataFrame
88-
89- # otherwise it is a SingleBlockManager (axis = 0)
90- return objs [0 ]._constructor
91-
92-
93- def _get_frame_result_type (result , objs ):
94- """
95- return appropriate class of DataFrame-like concat
96- if all blocks are sparse, return SparseDataFrame
97- otherwise, return 1st obj
98- """
99-
100- if result .blocks and (any (isinstance (obj , ABCSparseDataFrame ) for obj in objs )):
101- from pandas .core .sparse .api import SparseDataFrame
102-
103- return SparseDataFrame
104- else :
105- return next (obj for obj in objs if not isinstance (obj , ABCSparseDataFrame ))
106-
107-
108- def _concat_compat (to_concat , axis = 0 ):
73+ def concat_compat (to_concat , axis = 0 ):
10974 """
11075 provide concatenation of an array of arrays each of which is a single
11176 'normalized' dtypes (in that for example, if it's object, then it is a
@@ -142,12 +107,12 @@ def is_nonempty(x):
142107 _contains_period = any (typ .startswith ("period" ) for typ in typs )
143108
144109 if "category" in typs :
145- # this must be prior to _concat_datetime ,
110+ # this must be prior to concat_datetime ,
146111 # to support Categorical + datetime-like
147- return _concat_categorical (to_concat , axis = axis )
112+ return concat_categorical (to_concat , axis = axis )
148113
149114 elif _contains_datetime or "timedelta" in typs or _contains_period :
150- return _concat_datetime (to_concat , axis = axis , typs = typs )
115+ return concat_datetime (to_concat , axis = axis , typs = typs )
151116
152117 # these are mandated to handle empties as well
153118 elif "sparse" in typs :
@@ -174,7 +139,7 @@ def is_nonempty(x):
174139 return np .concatenate (to_concat , axis = axis )
175140
176141
177- def _concat_categorical (to_concat , axis = 0 ):
142+ def concat_categorical (to_concat , axis = 0 ):
178143 """Concatenate an object/categorical array of arrays, each of which is a
179144 single dtype
180145
@@ -214,7 +179,7 @@ def _concat_categorical(to_concat, axis=0):
214179 else np .asarray (x .astype (object ))
215180 for x in to_concat
216181 ]
217- result = _concat_compat (to_concat )
182+ result = concat_compat (to_concat )
218183 if axis == 1 :
219184 result = result .reshape (1 , len (result ))
220185 return result
@@ -400,7 +365,7 @@ def _concatenate_2d(to_concat, axis):
400365 return np .concatenate (to_concat , axis = axis )
401366
402367
403- def _concat_datetime (to_concat , axis = 0 , typs = None ):
368+ def concat_datetime (to_concat , axis = 0 , typs = None ):
404369 """
405370 provide concatenation of an datetimelike array of arrays each of which is a
406371 single M8[ns], datetimet64[ns, tz] or m8[ns] dtype
0 commit comments