File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 2020^^^^^^
2121
2222 - New method :meth: `.Styler.to_string ` for alternative customisable output methods (:issue: `44502 `)
23+ - Various bug fixes, see below.
2324
2425.. _whatsnew_150.enhancements.enhancement2 :
2526
@@ -258,7 +259,7 @@ ExtensionArray
258259
259260Styler
260261^^^^^^
261- -
262+ - Minor bug when attempting to apply styling functions to an empty DataFrame subset ( :issue: ` 45313 `)
262263-
263264
264265Other
Original file line number Diff line number Diff line change @@ -1486,7 +1486,9 @@ def _apply(
14861486 subset = slice (None ) if subset is None else subset
14871487 subset = non_reducing_slice (subset )
14881488 data = self .data .loc [subset ]
1489- if axis is None :
1489+ if data .empty :
1490+ result = DataFrame ()
1491+ elif axis is None :
14901492 result = func (data , ** kwargs )
14911493 if not isinstance (result , DataFrame ):
14921494 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():
15481548 assert ctx ["head" ][0 ][c + 2 ]["is_visible" ] == vals [1 ]
15491549
15501550 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