@@ -223,7 +223,16 @@ def func(df: PandasLikeDataFrame) -> list[PandasLikeSeries]:
223223 context = self ,
224224 )
225225
226- def _horizontal_concat (self , dfs : Sequence [NDFrameT ], / ) -> NDFrameT :
226+ def _concat_diagonal (self , dfs : Sequence [NDFrameT ], / ) -> NDFrameT :
227+ """Concatenate (native) DataFrames diagonally."""
228+ concat = self ._implementation .to_native_namespace ().concat
229+ if self ._implementation .is_pandas () and self ._backend_version < (3 ,):
230+ if self ._backend_version < (1 ,):
231+ return concat (dfs , axis = 0 , copy = False , sort = False )
232+ return concat (dfs , axis = 0 , copy = False )
233+ return concat (dfs , axis = 0 )
234+
235+ def _concat_horizontal (self , dfs : Sequence [NDFrameT ], / ) -> NDFrameT :
227236 """Concatenate (native) DataFrames horizontally."""
228237 concat = self ._implementation .to_native_namespace ().concat
229238 if self ._implementation .is_cudf ():
@@ -238,16 +247,7 @@ def _horizontal_concat(self, dfs: Sequence[NDFrameT], /) -> NDFrameT:
238247 return concat (dfs , axis = 1 , copy = False )
239248 return concat (dfs , axis = 1 )
240249
241- def _diagonal_concat (self , dfs : Sequence [NDFrameT ], / ) -> NDFrameT :
242- """Concatenate (native) DataFrames diagonally."""
243- concat = self ._implementation .to_native_namespace ().concat
244- if self ._implementation .is_pandas () and self ._backend_version < (3 ,):
245- if self ._backend_version < (1 ,):
246- return concat (dfs , axis = 0 , copy = False , sort = False )
247- return concat (dfs , axis = 0 , copy = False )
248- return concat (dfs , axis = 0 )
249-
250- def _vertical_concat (self , dfs : Sequence [pd .DataFrame ], / ) -> pd .DataFrame :
250+ def _concat_vertical (self , dfs : Sequence [pd .DataFrame ], / ) -> pd .DataFrame :
251251 """Concatenate (native) DataFrames vertically."""
252252 concat = self ._implementation .to_native_namespace ().concat
253253 cols_0 = dfs [0 ].columns
@@ -271,11 +271,11 @@ def concat(
271271 ) -> PandasLikeDataFrame :
272272 dfs : list [pd .DataFrame ] = [item .native for item in items ]
273273 if how == "horizontal" :
274- native = self ._horizontal_concat (dfs )
274+ native = self ._concat_horizontal (dfs )
275275 elif how == "vertical" :
276- native = self ._vertical_concat (dfs )
276+ native = self ._concat_vertical (dfs )
277277 elif how == "diagonal" :
278- native = self ._diagonal_concat (dfs )
278+ native = self ._concat_diagonal (dfs )
279279 else :
280280 raise NotImplementedError
281281 return PandasLikeDataFrame .from_native (native , context = self )
0 commit comments