From 3f39d2adc3108fdcd8230c7225af4f98045e0be6 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Wed, 24 Jun 2015 20:08:45 -0400 Subject: [PATCH] BUG: provide categorical concat always on axis 0, #10430 numpy 1.10 makes this an error for 1-d on axis != 0 --- .gitignore | 2 ++ pandas/core/categorical.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e8b557d68ac39..c0f576178ecc0 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,8 @@ doc/_build dist # Egg metadata *.egg-info +.eggs + # tox testing tool .tox # rope diff --git a/pandas/core/categorical.py b/pandas/core/categorical.py index a9e5d1f3f0ebd..edd4a532cf8f5 100644 --- a/pandas/core/categorical.py +++ b/pandas/core/categorical.py @@ -1722,6 +1722,7 @@ def _concat_compat(to_concat, axis=0): ---------- to_concat : array of arrays axis : axis to provide concatenation + in the current impl this is always 0, e.g. we only have 1-d categoricals Returns ------- @@ -1744,7 +1745,7 @@ def convert_categorical(x): # convert to object type and perform a regular concat from pandas.core.common import _concat_compat - return _concat_compat([ np.array(x,copy=False).astype('object') for x in to_concat ],axis=axis) + return _concat_compat([ np.array(x,copy=False).astype('object') for x in to_concat ],axis=0) # we could have object blocks and categorical's here # if we only have a single cateogoricals then combine everything @@ -1761,4 +1762,4 @@ def convert_categorical(x): raise ValueError("incompatible categories in categorical concat") # concat them - return Categorical(np.concatenate([ convert_categorical(x) for x in to_concat ],axis=axis), categories=categories) + return Categorical(np.concatenate([ convert_categorical(x) for x in to_concat ],axis=0), categories=categories)