-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
>>> import pandas as pd >>> df = pd.DataFrame(data={'a': [1, 2, 3], 'b': [4, 5, 6]}) >>> print(df.groupby("a").agg([])) # Passing an empty list as argument Empty DataFrame Columns: [] Index: [] >>> print(df.groupby("a").agg(())) # Passing an empty tuple as argument Empty DataFrame Columns: [] Index: [] >>> print(df.groupby("a").agg({})) # Passing an empty dictionary as argument .... ValueError: No objects to concatenateIssue Description
Passing an empty list or tuple to groupby.agg returns an empty dataframe but an empty dictionary raises a ValueError.
This is part of an effort to find consistency between pandas operations with empty inputs. Issue #47959 is an attempt to start a discussion on this.
Expected Behavior
Some Consistency
Installed Versions
pandas : 1.5.0.dev0+1478.g94044c8532
numpy : 1.22.3
pytz : 2022.1
dateutil : 2.8.2
setuptools : 60.9.3
pip : 22.1.1
Cython : 0.29.32
pytest : 7.1.2
hypothesis : 6.52.3
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.8.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.3.0
pandas_datareader: 0.10.0
bs4 : 4.11.1
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.5.2
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.1
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None