Skip to content

New string data type aggregations (min, max, sum) work for DataFrames but not Series #31746

Closed
@tdpetrou

Description

@tdpetrou
>>> s = pd.Series(['a', 'b'], dtype='string')
>>> s.max()
TypeError: Cannot perform reduction 'max' with string dtype
>>> df = s.to_frame()
>>> df.max()
0    b
dtype: object

Problem description

I assume this isn't supposed to work on DataFrames if it doesn't work on strings. min and sum do the same thing.

Expected Output

Consistent behavior for both dataframes and series

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.8.1.final.0
python-bits : 64
OS : Darwin
OS-release : 19.2.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 0+untagged.1.gce8af21.dirty
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.1.0.post20200127
Cython : 0.29.14
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.5.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.11.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.5.0
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : 1.3.1
sqlalchemy : 1.3.13
tables : None
tabulate : 0.8.3
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None

Metadata

Metadata

Assignees

Labels

ExtensionArrayExtending pandas with custom dtypes or arrays.Needs TestsUnit test(s) needed to prevent regressionsNuisance ColumnsIdentifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.applyReduction Operationssum, mean, min, max, etc.StringsString extension data type and string datagood first issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions