Skip to content

Commit 3f39d2a

Browse files
committed
BUG: provide categorical concat always on axis 0, pandas-dev#10430
numpy 1.10 makes this an error for 1-d on axis != 0
1 parent 4a4fe0b commit 3f39d2a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ doc/_build
4141
dist
4242
# Egg metadata
4343
*.egg-info
44+
.eggs
45+
4446
# tox testing tool
4547
.tox
4648
# rope

pandas/core/categorical.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,7 @@ def _concat_compat(to_concat, axis=0):
17221722
----------
17231723
to_concat : array of arrays
17241724
axis : axis to provide concatenation
1725+
in the current impl this is always 0, e.g. we only have 1-d categoricals
17251726
17261727
Returns
17271728
-------
@@ -1744,7 +1745,7 @@ def convert_categorical(x):
17441745

17451746
# convert to object type and perform a regular concat
17461747
from pandas.core.common import _concat_compat
1747-
return _concat_compat([ np.array(x,copy=False).astype('object') for x in to_concat ],axis=axis)
1748+
return _concat_compat([ np.array(x,copy=False).astype('object') for x in to_concat ],axis=0)
17481749

17491750
# we could have object blocks and categorical's here
17501751
# if we only have a single cateogoricals then combine everything
@@ -1761,4 +1762,4 @@ def convert_categorical(x):
17611762
raise ValueError("incompatible categories in categorical concat")
17621763

17631764
# concat them
1764-
return Categorical(np.concatenate([ convert_categorical(x) for x in to_concat ],axis=axis), categories=categories)
1765+
return Categorical(np.concatenate([ convert_categorical(x) for x in to_concat ],axis=0), categories=categories)

0 commit comments

Comments
 (0)