DEPR: Styler.where
in favour of using applymap
and apply
#40124
Labels
API - Consistency
Internal Consistency of API/Behavior
Styler
conditional formatting using DataFrame.style
Milestone
Styler
by definition is a conditional renderer. The functions it provides,apply
andapplymap
, serve as conditional functions to render a style.The function
Styler.where
therefore, in the first case, seems unnecessary and indirectly confusing since it is a conditional rendering function implying perhaps the other methods are not. Not only is it just a 'convenience' wrapper ofapplymap
:But I also think, in the second case, it is quite inconvenient for a couple reasons:
and in fact
kwargs
appear in the code but do nothing.apply
andapplymap
to the same effect through good examples.For example:
styler.applymap(lambda v: props if cond(v) else None, subset=subset)
orstyler.apply(lambda d: np.where(d > 10, props, ""), axis=None, subset=subset)
seem pretty straightforward replacements???
Perhaps documenting in the first instance that
apply
andapplymap
are preferred overwhere
is non-controversial.The text was updated successfully, but these errors were encountered: