-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Description
Code Sample
import pandas as pd print(pd.DataFrame([{ 'A': 1, 'B': 1, }, { 'A': 2, 'B': 2, }, { 'A': 2, 'B': 3, }]).groupby('A', squeeze=True).count())Problem description
I expected .groupby(squeeze=True) to, well, squeeze, and count() to return a Series. Instead squeeze=True doesn't seem to do anything, and count() returns a DataFrame.
A workaround is to write .groupby('A').count().squeeze(), which does work.
Expected Output
A 1 1 2 2 Name: B, dtype: int64 Actual output
B A 1 1 2 2 Output of pd.show_versions()
pandas : 1.0.1
numpy : 1.17.4
pytz : 2019.3
dateutil : 2.8.1
pip : 18.1
setuptools : 44.0.0
Cython : None
pytest : 4.6.9
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.5.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.12.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.5.0
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 4.6.9
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None