Closed
Description
import pandas as pd
df = pd.DataFrame({"c0":["A","A","B","B"], "c1":["C","C","D","D"]})
df.apply(lambda s:s.astype("category"))
the resut is a series with series as element, not a dataframe:
c0 [A, A, B, B]
Categories (2, object): [A < B]
c1 [C, C, D, D]
Categories (2, object): [C < D]
dtype: object
Here is the output of `show_vershons()`:
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: x86
processor: x86 Family 6 Model 42 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.15.2.dev
nose: 1.3.4
Cython: 0.21.2
numpy: 1.9.1
scipy: 0.15.0
statsmodels: 0.6.1
IPython: 3.0.0
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.3
pytz: 2014.10
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.4.2
openpyxl: None
xlrd: 0.9.3
xlwt: None
xlsxwriter: 0.6.5
lxml: 3.4.1
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
rpy2: 2.5.4
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None