Skip to content

.transform not respecting axis=1 in combine stage of group-apply-combine #13103

Closed
@erbian

Description

@erbian

.transform does not appear to be respecting the axis argument of the groupby in the combine stage. The code below yields:
ValueError: Length mismatch: Expected axis has 4 elements, new values have 5 elements

#### Code Sample, a copy-pastable example if possible
import pandas as pd
df = pd.DataFrame(pd.np.arange(20).reshape(4,5))
df.groupby(lambda x: x <= 3, axis=1).transform(lambda x: x)

#### Expected Output
    0   1   2   3   4
0   0   1   2   3   4
1   5   6   7   8   9
2  10  11  12  13  14
3  15  16  17  18  19

#### output of ``pd.show_versions()``
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-74-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.17.1
nose: 1.3.7
pip: 1.5.4
setuptools: 20.1.1
Cython: None
numpy: 1.11.0
scipy: 0.17.0
statsmodels: 0.6.1
IPython: 4.1.1
sphinx: None
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: 1.0.0
tables: None
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: 2.3.3
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: None
lxml: 3.5.0
bs4: None
html5lib: 0.999
httplib2: 0.9.2
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
Jinja2: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions