-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Groupby agg works with pd.Series.nunique, but groupby nunique fails with axis=1 #30253
New issue
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
Comments
this is. very old version of pandas pls try on latest and on master |
df.groupby(axis=1, level=0).agg(pd.Series.nunique) Traceback (most recent call last): |
I think an issue with >>> df.T.groupby(level=0).nunique().T
A D
2019-12-12 1 1
2019-12-13 2 1 Interested in trying to debug @nlepleux ? |
I can surely try |
Code Sample, a copy-pastable example if possible
Problem description
The groupby nunique crashes with error "ValueError: all keys need to be the same shape", whereas the groupby agg with pd.Series.nunique does not crash
Expected Output
pd.DataFrame({
'A': [1, 2],
'D': [1, 1]
}, index=pd.bdate_range('20191212', '20191213'))
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.8.final.0
python-bits: 64
OS: Linux
OS-release: 2.6.32-642.6.2.el6.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.21.1
pytest: 4.4.1
pip: 18.1
setuptools: 40.8.0.post20190628
Cython: 0.27.3
numpy: 1.13.3
scipy: 0.19.1
pyarrow: None
xarray: 0.8.2
IPython: 5.1.0
sphinx: 1.8.5
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: 3.4.4
numexpr: 2.6.5
feather: None
matplotlib: 2.1.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.9999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: