Skip to content

Commit b464b65

Browse files
committed
PERF: speed up concat on Series by skipping unnecessary DataFrame creation
1 parent a26005a commit b464b65

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/source/whatsnew/v0.24.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ Performance Improvements
981981
- Improved the performance of :func:`pandas.get_dummies` with ``sparse=True`` (:issue:`21997`)
982982
- Improved performance of :func:`IndexEngine.get_indexer_non_unique` for sorted, non-unique indexes (:issue:`9466`)
983983
- Improved performance of :func:`PeriodIndex.unique` (:issue:`23083`)
984+
- Improved performance of :func:`pd.concat` for `Series` objects (:issue:`23404`)
984985

985986

986987
.. _whatsnew_0240.docs:

pandas/core/reshape/concat.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ def __init__(self, objs, axis=0, join='outer', join_axes=None,
320320

321321
# Standardize axis parameter to int
322322
if isinstance(sample, Series):
323-
axis = DataFrame()._get_axis_number(axis)
323+
if compat.PY2:
324+
axis = DataFrame()._get_axis_number(axis)
325+
else:
326+
axis = DataFrame._get_axis_number(DataFrame, axis)
324327
else:
325328
axis = sample._get_axis_number(axis)
326329

0 commit comments

Comments
 (0)