Description
old = pd.Series(range(9))
new = pd.Series(range(9), dtype='Int64')
print(old.min(), old.values.min(), new.min()) # =0 OK
print(new.values.min()) # KO
old.to_frame().style.background_gradient() # OK
new.to_frame().style.background_gradient() # KO
Problem description
Similarly to #25580, the newer Int64 backend is missing some basic functionality.
Expected: values.min() is available, gradients are displayed
Actual:
----> 1 print(new.values.min())
AttributeError: 'IntegerArray' object has no attribute 'min'
and full stack of the background_gradient
error:
AttributeError Traceback (most recent call last)
~/virtualenvs/jupyter/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/io/formats/style.py in _repr_html_(self)
161 Hooks into Jupyter notebook rich display system.
162 """
--> 163 return self.render()
164
165 @Appender(_shared_docs['to_excel'] % dict(
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/io/formats/style.py in render(self, **kwargs)
457 * table_attributes
458 """
--> 459 self._compute()
460 # TODO: namespace all the pandas keys
461 d = self._translate()
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/io/formats/style.py in _compute(self)
527 r = self
528 for func, args, kwargs in self._todo:
--> 529 r = func(self)(*args, **kwargs)
530 return r
531
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/io/formats/style.py in _apply(self, func, axis, subset, **kwargs)
536 if axis is not None:
537 result = data.apply(func, axis=axis,
--> 538 result_type='expand', **kwargs)
539 result.columns = data.columns
540 else:
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/core/frame.py in apply(self, func, axis, broadcast, raw, reduce, result_type, args, **kwds)
6485 args=args,
6486 kwds=kwds)
-> 6487 return op.get_result()
6488
6489 def applymap(self, func):
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/core/apply.py in get_result(self)
149 return self.apply_raw()
150
--> 151 return self.apply_standard()
152
153 def apply_empty_result(self):
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/core/apply.py in apply_standard(self)
255
256 # compute the result using the series generator
--> 257 self.apply_series_generator()
258
259 # wrap results
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/core/apply.py in apply_series_generator(self)
284 try:
285 for i, v in enumerate(series_gen):
--> 286 results[i] = self.f(v)
287 keys.append(v.name)
288 except Exception as e:
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/core/apply.py in f(x)
76
77 def f(x):
---> 78 return func(x, *args, **kwds)
79 else:
80 f = func
~/virtualenvs/jupyter/lib/python3.6/site-packages/pandas/io/formats/style.py in _background_gradient(s, cmap, low, high, text_color_threshold)
939
940 with _mpl(Styler.background_gradient) as (plt, colors):
--> 941 smin = s.values.min()
942 smax = s.values.max()
943 rng = smax - smin
AttributeError: ("'IntegerArray' object has no attribute 'min'", 'occurred at index 0')
Output of pd.show_versions()
commit: None
python: 3.6.8.final.0
python-bits: 64
OS: Linux
OS-release: 3.10.0-1062.1.1.el7.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.24.2
pytest: 5.0.1
pip: 19.2.3
setuptools: 41.0.1
Cython: None
numpy: 1.16.3
scipy: 1.3.0
pyarrow: None
xarray: None
IPython: 7.5.0
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2019.1
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.1.0
openpyxl: None
xlrd: 1.2.0
xlwt: None
xlsxwriter: None
lxml.etree: 4.3.3
bs4: None
html5lib: None
sqlalchemy: 1.3.3
pymysql: None
psycopg2: None
jinja2: 2.10.1
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None