We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In [17]: df = pd.DataFrame([['foo', True], ...: [np.nan, True], ...: ['foo', True]], columns=['key', 'val']) In [13]: df.groupby('key')['val'].transform('any') Out[13]: 0 True 1 NaN 2 True Name: val, dtype: object In [14]: df.groupby('key')['val'].transform(np.any) ... ~/clones/pandas/pandas/core/internals.py in set_axis(self, axis, new_labels) 3280 raise ValueError( 3281 'Length mismatch: Expected axis has {old} elements, new ' -> 3282 'values have {new} elements'.format(old=old_len, new=new_len)) 3283 3284 self.axes[axis] = new_labels ValueError: Length mismatch: Expected axis has 2 elements, new values have 3 elements
I've only seen this value error when using np.any and np.all. Other aggs (at least np.sum, np.min, np.max) seem to work fine
commit: fa24af9 python: 3.6.4.final.0 python-bits: 64 OS: Darwin OS-release: 17.5.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8
pandas: 0.23.0.dev0+738.gfa24af91a.dirty pytest: 3.4.1 pip: 9.0.1 setuptools: 38.5.1 Cython: 0.27.3 numpy: 1.14.1 scipy: 1.0.0 pyarrow: 0.8.0 xarray: 0.10.0 IPython: 6.2.1 sphinx: 1.7.0 patsy: 0.5.0 dateutil: 2.6.1 pytz: 2018.3 blosc: None bottleneck: 1.2.1 tables: 3.4.2 numexpr: 2.6.4 feather: 0.4.0 matplotlib: 2.1.2 openpyxl: 2.5.0 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.0.2 lxml: 4.1.1 bs4: 4.6.0 html5lib: 1.0.1 sqlalchemy: 1.2.5 pymysql: 0.8.0 psycopg2: 2.7.4 (dt dec pq3 ext lo64) jinja2: 2.10 s3fs: 0.1.3 fastparquet: 0.1.4 pandas_gbq: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
That sounds odd! Investigation and PR are welcome!
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
I've only seen this value error when using np.any and np.all. Other aggs (at least np.sum, np.min, np.max) seem to work fine
INSTALLED VERSIONS
commit: fa24af9
python: 3.6.4.final.0
python-bits: 64
OS: Darwin
OS-release: 17.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.0.dev0+738.gfa24af91a.dirty
pytest: 3.4.1
pip: 9.0.1
setuptools: 38.5.1
Cython: 0.27.3
numpy: 1.14.1
scipy: 1.0.0
pyarrow: 0.8.0
xarray: 0.10.0
IPython: 6.2.1
sphinx: 1.7.0
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2018.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: 0.4.0
matplotlib: 2.1.2
openpyxl: 2.5.0
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.5
pymysql: 0.8.0
psycopg2: 2.7.4 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: 0.1.3
fastparquet: 0.1.4
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: