File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 20
20
^^^^^^
21
21
22
22
- New method :meth: `.Styler.to_string ` for alternative customisable output methods (:issue: `44502 `)
23
+ - Various bug fixes, see below.
23
24
24
25
.. _whatsnew_150.enhancements.enhancement2 :
25
26
@@ -258,7 +259,7 @@ ExtensionArray
258
259
259
260
Styler
260
261
^^^^^^
261
- -
262
+ - Minor bug when attempting to apply styling functions to an empty DataFrame subset ( :issue: ` 45313 `)
262
263
-
263
264
264
265
Other
Original file line number Diff line number Diff line change @@ -1486,7 +1486,9 @@ def _apply(
1486
1486
subset = slice (None ) if subset is None else subset
1487
1487
subset = non_reducing_slice (subset )
1488
1488
data = self .data .loc [subset ]
1489
- if axis is None :
1489
+ if data .empty :
1490
+ result = DataFrame ()
1491
+ elif axis is None :
1490
1492
result = func (data , ** kwargs )
1491
1493
if not isinstance (result , DataFrame ):
1492
1494
if not isinstance (result , np .ndarray ):
Original file line number Diff line number Diff line change @@ -1548,3 +1548,9 @@ def test_col_trimming_hide_columns():
1548
1548
assert ctx ["head" ][0 ][c + 2 ]["is_visible" ] == vals [1 ]
1549
1549
1550
1550
assert len (ctx ["body" ][0 ]) == 6 # index + 2 hidden + 2 visible + trimming col
1551
+
1552
+
1553
+ def test_no_empty_apply (mi_styler ):
1554
+ # 45313
1555
+ mi_styler .apply (lambda s : ["a:v;" ] * 2 , subset = [False , False ])
1556
+ mi_styler ._compute ()
You can’t perform that action at this time.
0 commit comments