diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 542dc69aa35f4..a94e627952b75 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -245,7 +245,7 @@ def apply(self, func, **kwargs): """ apply the function to my values; return a block if we are not one """ result = func(self.values) if not isinstance(result, Block): - result = make_block(values=result, placement=self.mgr_locs,) + result = make_block(values=_block_shape(result), placement=self.mgr_locs,) return result diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py index e05d7285592aa..7681289cf41ac 100644 --- a/pandas/tests/test_categorical.py +++ b/pandas/tests/test_categorical.py @@ -1306,6 +1306,18 @@ def test_repr(self): self.assertEqual(exp,a.__unicode__()) + def test_info(self): + + # make sure it works + n = 2500 + df = DataFrame({ 'int64' : np.random.randint(100,size=n) }) + df['category'] = Series(np.array(list('abcdefghij')).take(np.random.randint(0,10,size=n))).astype('category') + df.isnull() + df.info() + + df2 = df[df['category']=='d'] + df2.info() + def test_groupby_sort(self): # http://stackoverflow.com/questions/23814368/sorting-pandas-categorical-labels-after-groupby